13 Replies Latest reply on Jan 18, 2016 2:20 AM by Ondra Chaloupka

    Local Byteman installation (compilation) with Maven

    Ondra Chaloupka Expert

      Hi,

       

      I would like to propose a small enhancement for dtest library [1]. Namely I'm missing a way how to instrument a class (with use of Intrumentor) without need of having it on classpath.

       

      When trying to install the byteman snapshot with my fixes I hit a problem to successfully finish the installation. Please, what is the right way to do so? I've tried to run

      mvn install

      in byteman root directory but I've finished with javadoc plugin errors [2]. What I do  wrong?

       

      Thanks for any tip and help

      Ondra

       

      [1] https://github.com/ochaloup/byteman/commit/8b514c6d96f7dabe5860b9202ea088c5f8646486

      [2]

      [INFO] Reactor Summary:
      [INFO] 
      [INFO] byteman-root ....................................... SUCCESS [  0.370 s]
      [INFO] byteman-submit ..................................... SUCCESS [  0.541 s]
      [INFO] byteman-agent ...................................... SUCCESS [ 52.583 s]
      [INFO] byteman-install .................................... SUCCESS [  0.095 s]
      [INFO] byteman-bmunit ..................................... SUCCESS [  4.881 s]
      [INFO] byteman-dtest ...................................... SUCCESS [  0.075 s]
      [INFO] byteman-rulecheck maven plugin ..................... SUCCESS [  3.321 s]
      [INFO] byteman-jboss-modules .............................. SUCCESS [  0.006 s]
      [INFO] byteman-jboss-modules-plugin ....................... SUCCESS [  0.072 s]
      [INFO] byteman-jboss-modules-tests ........................ SUCCESS [  4.101 s]
      [INFO] byteman-sample ..................................... SUCCESS [  0.039 s]
      [INFO] byteman-download ................................... FAILURE [  0.453 s]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 01:06 min
      [INFO] Finished at: 2016-01-07T11:48:34+01:00
      [INFO] Final Memory: 41M/574M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single (create-bin-zip) on project byteman-download: Failed to create assembly: Unable to resolve dependencies for assembly 'bin': Failed to resolve dependencies for assembly: Missing:
      [ERROR] ----------
      [ERROR] 1) org.jboss.byteman:byteman-sample:jar:javadoc:3.0.4-SNAPSHOT
      [ERROR] 
      [ERROR] Try downloading the file manually from the project website.
      [ERROR] 
      [ERROR] Then, install it using the command:
      [ERROR] mvn install:install-file -DgroupId=org.jboss.byteman -DartifactId=byteman-sample -Dversion=3.0.4-SNAPSHOT -Dclassifier=javadoc -Dpackaging=jar -Dfile=/path/to/file
      [ERROR] 
      [ERROR] Alternatively, if you host your own repository you can deploy the file there:
      [ERROR] mvn deploy:deploy-file -DgroupId=org.jboss.byteman -DartifactId=byteman-sample -Dversion=3.0.4-SNAPSHOT -Dclassifier=javadoc -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
      [ERROR] 
      [ERROR] Path to dependency:
      [ERROR] 1) org.jboss.byteman:byteman-download:pom:3.0.4-SNAPSHOT
      [ERROR] 2) org.jboss.byteman:byteman-sample:jar:javadoc:3.0.4-SNAPSHOT
      [ERROR] 
      [ERROR] 2) org.jboss.byteman:byteman-jboss-modules-plugin:jar:javadoc:3.0.4-SNAPSHOT
      [ERROR] 
      [ERROR] Try downloading the file manually from the project website.
      [ERROR] 
      [ERROR] Then, install it using the command:
      [ERROR] mvn install:install-file -DgroupId=org.jboss.byteman -DartifactId=byteman-jboss-modules-plugin -Dversion=3.0.4-SNAPSHOT -Dclassifier=javadoc -Dpackaging=jar -Dfile=/path/to/file
      [ERROR] 
      [ERROR] Alternatively, if you host your own repository you can deploy the file there:
      [ERROR] mvn deploy:deploy-file -DgroupId=org.jboss.byteman -DartifactId=byteman-jboss-modules-plugin -Dversion=3.0.4-SNAPSHOT -Dclassifier=javadoc -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
      [ERROR] 
      [ERROR] Path to dependency:
      [ERROR] 1) org.jboss.byteman:byteman-download:pom:3.0.4-SNAPSHOT
      [ERROR] 2) org.jboss.byteman:byteman-jboss-modules-plugin:jar:javadoc:3.0.4-SNAPSHOT
      [ERROR] 
      [ERROR] ----------
      [ERROR] 2 required artifacts are missing.
      [ERROR] 
      [ERROR] for artifact:
      [ERROR] org.jboss.byteman:byteman-download:pom:3.0.4-SNAPSHOT
      [ERROR] 
      [ERROR] from the specified remote repositories:
      [ERROR] jboss-public-repository-group (http://repository.jboss.org/nexus/content/groups/public/, releases=true, snapshots=true),
      [ERROR] ow2 (http://repository.ow2.org/nexus/content/repositories/releases/, releases=true, snapshots=true),
      [ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
      [ERROR] -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      [ERROR] 
      [ERROR] After correcting the problems, you can resume the build with the command
      [ERROR]   mvn <goals> -rf :byteman-download
      
      
      
      
        • 1. Re: Local Byteman installation (compilation) with Maven
          Andrew Dinn Master

          Hi Ondra,

           

          I notice that your github repo is based on 2.1.4-SNAPSHOT while the artifact that the download plugin is looking for has version 3.0.4-SNAPSHOT. Perhaps you have imported some but not all the changes from upstream into your local clone?

           

          I recommend that you pull all upstream changes into your own repo and rebase your fix. As simpler option might be just to reclone the latest upstream repo and re-apply your patch.

           

          regards,

           

           

          Andrew Dinn

          • 2. Re: Local Byteman installation (compilation) with Maven
            Ondra Chaloupka Expert

            Hi Andrew,

             

            thanks for support but I'm still a bit stuck

             

            What I did

             

            • git clone git@github.com:bytemanproject/byteman.git byteman-recloned
            • cd byteman-recloned
            • mvn install

             

            I've got the first error [1]. If I fixed the ModuleSystem !param names to be consistent with method parameters I've got to the second error [2] which I'm not able to solve as I do not understand where is the HelpMojo class generated from.

            Could it be a problem of only my laptop? Or problem exists just between keyboard and chair?

             

            Thanks

             

            [1]

            [INFO] ------------------------------------------------------------------------
            [INFO] Reactor Summary:
            [INFO]
            [INFO] byteman-root ....................................... SUCCESS [  0.814 s]
            [INFO] byteman-submit ..................................... SUCCESS [  2.222 s]
            [INFO] byteman-agent ...................................... FAILURE [  7.786 s]
            [INFO] byteman-install .................................... SKIPPED
            [INFO] byteman-bmunit ..................................... SKIPPED
            [INFO] byteman-dtest ...................................... SKIPPED
            [INFO] byteman-rulecheck maven plugin ..................... SKIPPED
            [INFO] byteman-jboss-modules .............................. SKIPPED
            [INFO] byteman-jboss-modules-plugin ....................... SKIPPED
            [INFO] byteman-jboss-modules-tests ........................ SKIPPED
            [INFO] byteman-sample ..................................... SKIPPED
            [INFO] byteman-download ................................... SKIPPED
            [INFO] ------------------------------------------------------------------------
            [INFO] BUILD FAILURE
            [INFO] ------------------------------------------------------------------------
            [INFO] Total time: 11.056 s
            [INFO] Finished at: 2016-01-08T14:26:27+01:00
            [INFO] Final Memory: 27M/330M
            [INFO] ------------------------------------------------------------------------
            [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.5:jar (javadoc-jar) on project byteman: MavenReportException: Error while creating archive:Exit code: 1 - /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/modules/ModuleSystem.java:12: error: @param name not found
            [ERROR] * @param triggerClassLoader the class loader of the trigger class which has been matched with this
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/modules/ModuleSystem.java:14: error: @param name not found
            [ERROR] * @param helperAdapterName the name of the helper adapter class to be loaded
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/modules/ModuleSystem.java:15: error: @param name not found
            [ERROR] * @param classBytes the byte array defining the class
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/modules/ModuleSystem.java:18: warning: no @param for helperLoader
            [ERROR] Class<?> loadHelperAdapter(CL helperLoader, String helperName, byte[] helperBytes);
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/modules/ModuleSystem.java:18: warning: no @param for helperName
            [ERROR] Class<?> loadHelperAdapter(CL helperLoader, String helperName, byte[] helperBytes);
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/modules/ModuleSystem.java:18: warning: no @param for helperBytes
            [ERROR] Class<?> loadHelperAdapter(CL helperLoader, String helperName, byte[] helperBytes);
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/rule/grammar/ECAGrammarParser.java:21: warning: no @param for s
            [ERROR] public ECAGrammarParser(java_cup.runtime.Scanner s) {super(s);}
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/rule/grammar/ECAGrammarParser.java:24: warning: no @param for s
            [ERROR] public ECAGrammarParser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/rule/grammar/ECAGrammarParser.java:24: warning: no @param for sf
            [ERROR] public ECAGrammarParser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/rule/grammar/ECATokenLexer.java:629: warning: no @throws for java.io.IOException
            [ERROR] public final void yyclose() throws java.io.IOException {
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/rule/grammar/ECATokenLexer.java:663: warning: no @return
            [ERROR] public final int yystate() {
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/rule/grammar/ECATokenLexer.java:681: warning: no @return
            [ERROR] public final String yytext() {
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/rule/grammar/ECATokenLexer.java:705: warning: no @return
            [ERROR] public final int yylength() {
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/agent/Retransformer.java:55: warning: no @param for moduleSystem
            [ERROR] public Retransformer(Instrumentation inst, ModuleSystem moduleSystem, List<String> scriptPaths, List<String> scriptTexts, boolean isRedefine)
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/agent/src/main/java/org/jboss/byteman/agent/RuleScript.java:121: warning: no @param for imports
            [ERROR] public RuleScript(String name, String targetClass, boolean isInterface, boolean isOverride, String targetMethod, String targetHelper, String[] imports, Location targetLocation, String ruleText, int line, String file, boolean compileToBytecode)
            [ERROR] ^
            [ERROR]
            [ERROR] Command line was:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-15.b17.fc23.x86_64/jre/../bin/javadoc @options @packages
            [ERROR] -> [Help 1]
            [ERROR]
            [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
            [ERROR] Re-run Maven using the -X switch to enable full debug logging.
            [ERROR]
            [ERROR] For more information about the errors and possible solutions, please read the following articles:
            [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
            [ERROR]
            [ERROR] After correcting the problems, you can resume the build with the command
            [ERROR]   mvn <goals> -rf :byteman

             

             

             

             

            [2]

            1 error
            2 warnings
            [INFO] ------------------------------------------------------------------------
            [INFO] Reactor Summary:
            [INFO]
            [INFO] byteman-root ....................................... SUCCESS [  0.842 s]
            [INFO] byteman-submit ..................................... SUCCESS [  1.607 s]
            [INFO] byteman-agent ...................................... SUCCESS [ 54.232 s]
            [INFO] byteman-install .................................... SUCCESS [  1.252 s]
            [INFO] byteman-bmunit ..................................... SUCCESS [  6.926 s]
            [INFO] byteman-dtest ...................................... SUCCESS [  1.924 s]
            [INFO] byteman-rulecheck maven plugin ..................... FAILURE [  5.920 s]
            [INFO] byteman-jboss-modules .............................. SKIPPED
            [INFO] byteman-jboss-modules-plugin ....................... SKIPPED
            [INFO] byteman-jboss-modules-tests ........................ SKIPPED
            [INFO] byteman-sample ..................................... SKIPPED
            [INFO] byteman-download ................................... SKIPPED
            [INFO] ------------------------------------------------------------------------
            [INFO] BUILD FAILURE
            [INFO] ------------------------------------------------------------------------
            [INFO] Total time: 01:12 min
            [INFO] Finished at: 2016-01-08T15:11:07+01:00
            [INFO] Final Memory: 50M/503M
            [INFO] ------------------------------------------------------------------------
            [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.5:jar (javadoc-jar) on project byteman-rulecheck-maven-plugin: MavenReportException: Error while creating archive:Exit code: 1 - /home/ochaloup/arquillian-byteman/byteman-recloned/contrib/rulecheck-maven-plugin/target/generated-sources/plugin/org/jboss/byteman/contrib/rulecheck/HelpMojo.java:24: error: self-closing element not allowed
            [ERROR] * Display help information on byteman-rulecheck-maven-plugin.<br/>
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/contrib/rulecheck-maven-plugin/target/generated-sources/plugin/org/jboss/byteman/contrib/rulecheck/HelpMojo.java:26: warning: no description for @author
            [ERROR] * @author
            [ERROR] ^
            [ERROR] /home/ochaloup/arquillian-byteman/byteman-recloned/contrib/rulecheck-maven-plugin/target/generated-sources/plugin/org/jboss/byteman/contrib/rulecheck/HelpMojo.java:27: warning: no description for @version
            [ERROR] * @version
            [ERROR] ^
            [ERROR]
            [ERROR] Command line was:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-15.b17.fc23.x86_64/jre/../bin/javadoc @options @packages
            [ERROR] -> [Help 1]
            [ERROR]
            [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
            [ERROR] Re-run Maven using the -X switch to enable full debug logging.
            [ERROR]
            [ERROR] For more information about the errors and possible solutions, please read the following articles:
            [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
            [ERROR]
            [ERROR] After correcting the problems, you can resume the build with the command
            [ERROR]   mvn <goals> -rf :byteman-rulecheck-maven-plugin

            • 3. Re: Local Byteman installation (compilation) with Maven
              Andrew Dinn Master

              HI Ondra,

               

              I just repeated your instructions above and it built fine.

               

              What is your JDK and maven version? I am using java 7 and maven 3.3.3.

              • 4. Re: Local Byteman installation (compilation) with Maven
                Ondra Chaloupka Expert

                Ouch... that's it. I was on OpenJDK 8. With java 7 it works. Thanks.

                • 5. Re: Local Byteman installation (compilation) with Maven
                  Andrew Dinn Master

                  Hmm, well it really ought to work with OpenJDK8 as well. I'll take a look to see what can be done to fix it.

                  • 6. Re: Local Byteman installation (compilation) with Maven
                    James Livingston Apprentice

                    I don't know how that didn't fail for me when I was writing the code, I've been using OpenJDK 8 too.

                    • 7. Re: Local Byteman installation (compilation) with Maven
                      Andrew Dinn Master

                      Hi James/Ondra,

                      James Livingston wrote:

                       

                      I don't know how that didn't fail for me when I was writing the code, I've been using OpenJDK 8 too.

                       

                      Me too. Maybe it depends on the jdk8 version. This is a real problem in the agent module because the parser generator generats code with missing tag values. I have fixed the problem in agent/pom.xml by changing the javadoc plugin settings to switch off checking for missing tags (see BYTEMAN-306). I also worked around the byteman maven rulecheck plugin pom the same way -- the real fix in that code is to correct the javadoc. This problem in the modules code can also be worked around by adding the relevant javadoc plugin config but really just needs the javadoc fixing.

                      • 8. Re: Local Byteman installation (compilation) with Maven
                        Ondra Chaloupka Expert

                        hm... I don't know if there could be some trouble on my machine. I can only say that it seems to work for any JDK7 but not for JDK8 for me.

                         

                        I use openjdk from fedora 23 (java-1.8.0-openjdk-1.8.0.65-15.b17.fc23.x86_64). Then tried with oracle jdk 1.8.0.65 which behaves the same way.

                        • 10. Re: Local Byteman installation (compilation) with Maven
                          Andrew Dinn Master

                          Hi Ondra,

                           

                          I cannot account for why you are seeing this and I am not since I used exactly the same JDK8 release -- although in my case on Fedora 21.

                           

                          In any, James' fix to the javadoc tags in the modules plugin is in trunk, as also is Severin's fix for the Byteman maven plugin and a fix to disable the javadoc errors in agent caused by the inability of the parser generator to correctly generate tag info. So, if you pull the latest git repo you should be able to get it to build.

                          • 11. Re: Local Byteman installation (compilation) with Maven
                            Ondra Chaloupka Expert

                            Thanks Andrew,

                             

                            unfortunately I'm still not the lucky one. Pulling the newest fixes (BYTEMAN-306) does not resolve failures that I can see [1].

                             

                            I asked on of my colleagues to clone the repo and run mvn install to get it installed and he ends with the same failures as me (he uses Debian). Would be possible that you have some locally change maven settings.xml or something?

                            This is quire strange to me. Btw. my maven version is 3.3.3.

                             

                            ondra

                             

                            [1]

                            ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.3:jar (javadoc-jar) on project byteman-rulecheck-maven-plugin: MavenReportException: Error while generating Javadoc:
                            [ERROR] Exit code: 1 - /home/ochaloup/arquillian-byteman/byteman/contrib/rulecheck-maven-plugin/target/generated-sources/plugin/org/jboss/byteman/contrib/rulecheck/HelpMojo.java:24: error: self-closing element not allowed
                            [ERROR] * Display help information on byteman-rulecheck-maven-plugin.<br/>
                            [ERROR] ^
                            [ERROR] /home/ochaloup/arquillian-byteman/byteman/contrib/rulecheck-maven-plugin/target/generated-sources/plugin/org/jboss/byteman/contrib/rulecheck/HelpMojo.java:26: warning: no description for @author
                            [ERROR] * @author
                            [ERROR] ^
                            [ERROR] /home/ochaloup/arquillian-byteman/byteman/contrib/rulecheck-maven-plugin/target/generated-sources/plugin/org/jboss/byteman/contrib/rulecheck/HelpMojo.java:27: warning: no description for @version
                            [ERROR] * @version
                            [ERROR] ^
                            [ERROR]
                            [ERROR] Command line was: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-15.b17.fc23.x86_64/jre/../bin/javadoc @options @packages
                            [ERROR]
                            [ERROR] Refer to the generated Javadoc files in '/home/ochaloup/arquillian-byteman/byteman/contrib/rulecheck-maven-plugin/target/apidocs' dir.

                            • 12. Re: Local Byteman installation (compilation) with Maven
                              James Livingston Apprentice

                              That is [MPLUGIN-244] Help mojo generates Javadoc, which is not accepted by JDK 8 doclint - ASF JIRA, which is either a bug in the Maven plugin or a bug in the JDK 8 JavaDoc lint phase, depending on which side you agree with. There isn't anything Byteman specific about it.

                              1 of 1 people found this helpful
                              • 13. Re: Local Byteman installation (compilation) with Maven
                                Ondra Chaloupka Expert

                                Ok, I see. Thanks a lot for the explanation. I have just one doubt here. I have been using Maven 3.3.3 and the bug seems to be fixed for version 3.3 already.