Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #29 Latest version of Aspectj (1.8.10) is not supported #34

Merged
merged 3 commits into from
Jan 8, 2018
Merged

Conversation

dheid
Copy link
Contributor

@dheid dheid commented Jan 6, 2018

The plugin build failed if the most recent version of AspectJ (1.8.13) is used. To solve this, I configured to use Java 8 and configured only the dependency org.codehaus.mojo:aspectj-maven-plugin to be included for plugin descriptor creation by the maven-plugin-plugin version 3.5 (differs from parent version, but works perfectly).

<!-- use parent's configuration -->
<version>3.5</version>
<configuration>
<mojoDependencies>org.codehaus.mojo:aspectj-maven-plugin</mojoDependencies>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because else the AspectJ dependencies will be scanned for Mojo annotation. This will fail, because of a corrupt class inside the AspectJ library.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some output here so we can look into that?

Copy link
Contributor Author

@dheid dheid Jan 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execution help-mojo of goal org.apache.maven.plugins:maven-plugin-plugin:3.4:helpmojo failed: 3379
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution help-mojo of goal org.apache.maven.plugins:maven-plugin-plugin:3.4:helpmojo failed: 3379
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	... 20 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3379
	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
	at org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.analyzeClassStream(DefaultMojoAnnotationsScanner.java:201)
	at org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.scanArchive(DefaultMojoAnnotationsScanner.java:139)
	at org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.scan(DefaultMojoAnnotationsScanner.java:108)
	at org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.scan(DefaultMojoAnnotationsScanner.java:75)
	at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.scanAnnotations(JavaAnnotationsMojoDescriptorExtractor.java:124)
	at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.execute(JavaAnnotationsMojoDescriptorExtractor.java:103)
	at org.apache.maven.tools.plugin.scanner.DefaultMojoScanner.populatePluginDescriptor(DefaultMojoScanner.java:96)
	at org.apache.maven.plugin.plugin.AbstractGeneratorMojo.execute(AbstractGeneratorMojo.java:245)
	at org.apache.maven.plugin.plugin.HelpGeneratorMojo.execute(HelpGeneratorMojo.java:92)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 more

I downloaded the maven-plugin-plugin code and instrumented the debugger to find the causing class. It is the class UpdateParserFiles within the default package of the aspectjtools-1.8.13.jar

I don't know why ASM is failing with this class and tried other ASM versions (6.0). It didn't work. The index out of bounds exceptions happen because of a wrong byte array size calculated for the class. I already did a pull request to just write out a warning in such cases:
apache/maven-plugin-tools#11

I don't think it is necessary to scan the AspectJ libraries for Mojo annotations. Since the AspectJ Maven plugin is the only source of Mojos, we can skip the external dependencies.

<mavenVersion>3.0.5</mavenVersion>
<doxiaVersion>1.6</doxiaVersion>
<mojo.java.target>1.7</mojo.java.target> <!-- aspectJ 1.8.7 is JDK 1.7 minimum -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this the travis config needs to change to jdk 1.8 only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JDK 1.8 is needed for AspectJ >= 1.8.9

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I know, but then the travis config needs to be updated (remove the jdk7 build), hence my comment. As you can see it is failing.

Can you also look into why the site-build is failing?

…d oraclejdk7 from Travis configuration)
@dheid
Copy link
Contributor Author

dheid commented Jan 8, 2018

Okay, the maven-site-plugin has the same problem...

@dheid
Copy link
Contributor Author

dheid commented Jan 8, 2018

I also applied the maven-plugin-plugin configuration to the reporting section. This fixes the problem with the Maven site generation. The plugin can now be completely built by Travis.

@davidkarlsen davidkarlsen merged commit 4aa3d23 into mojohaus:master Jan 8, 2018
@davidkarlsen
Copy link
Member

LGTM - thanks!

@davidkarlsen davidkarlsen added this to the aspectj-maven-plugin 1.11 milestone Jan 8, 2018
@dheid
Copy link
Contributor Author

dheid commented Jan 8, 2018 via email

@davidkarlsen
Copy link
Member

@bmarwell bmarwell added bug dependencies Pull requests that update a dependency file labels May 30, 2021
kriegaex added a commit to dev-aspectj/aspectj-maven-plugin that referenced this pull request Oct 19, 2023
The root cause for the problem was the 'mojoDependencies' config for
maven-plugin-plugin, which aimed to fix
https://issues.apache.org/jira/browse/MPLUGIN-328 by the workaround from
mojohaus/aspectj-maven-plugin#34. That old
workaround was actually bad to begin with, because it only included
dev.aspectj:aspectj-maven-plugin, therefore implicitly excluding other
dependencies like maven-reporting-impl. The latter, however, contains
class AbstractMavenReport, which led to all super class @parameter and
@component properties to not be included in the generated plugin.xml.

Relates to #137.
Solves https://issues.apache.org/jira/browse/MPLUGIN-483.
kriegaex added a commit to dev-aspectj/aspectj-maven-plugin that referenced this pull request Oct 20, 2023
The root cause for the problem was the 'mojoDependencies' config for
maven-plugin-plugin, which aimed to fix
https://issues.apache.org/jira/browse/MPLUGIN-328 by the workaround from
mojohaus/aspectj-maven-plugin#34. That old
workaround was actually bad to begin with, because it only included
dev.aspectj:aspectj-maven-plugin, therefore implicitly excluding other
dependencies like maven-reporting-impl. The latter, however, contains
class AbstractMavenReport, which led to all super class @parameter and
@component properties to not be included in the generated plugin.xml.

Relates to #137.
Solves https://issues.apache.org/jira/browse/MPLUGIN-483.
kriegaex added a commit to dev-aspectj/aspectj-maven-plugin that referenced this pull request Oct 20, 2023
The root cause for the problem was the 'mojoDependencies' config for
maven-plugin-plugin, which aimed to fix
https://issues.apache.org/jira/browse/MPLUGIN-328 by the workaround from
mojohaus/aspectj-maven-plugin#34. That old
workaround was actually bad to begin with, because it only included
dev.aspectj:aspectj-maven-plugin, therefore implicitly excluding other
dependencies like maven-reporting-impl. The latter, however, contains
class AbstractMavenReport, which led to all super class @parameter and
@component properties to not be included in the generated plugin.xml.

Relates to #137.
Solves https://issues.apache.org/jira/browse/MPLUGIN-483.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants