AspectJ compilation with maven throws java.lang.NoClassDefFoundError: org/aspectj/bridge/IMessageHolder -
AspectJ compilation with maven throws java.lang.NoClassDefFoundError: org/aspectj/bridge/IMessageHolder -
i next error when trying compile aspectj project.
[info] --- aspectj-maven-plugin:1.4:compile (default) @ jetserver --- feb 2, 2012 7:33:31 pm org.sonatype.guice.bean.reflect.loadedclass warning: error injecting: org.codehaus.mojo.aspectj.ajccompilemojo java.lang.noclassdeffounderror: org/aspectj/bridge/imessageholder @ java.lang.class.getdeclaredconstructors0(native method) [error] failed execute goal org.codehaus.mojo:aspectj-maven-plugin:1.4:compile (default) on project game-server: execution default of goal org.codehaus.mojo:aspectj-maven-plugin:1.4:compile failed: unable load mojo 'compile' in plugin 'org.codehaus.mojo:aspectj-maven-plugin:1.4'. required class missing: org/aspectj/bridge/imessageholder
the relevant part of pom pasted below. ideas why error?
<build> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>aspectj-maven-plugin</artifactid> <version>1.4</version> <dependencies> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjrt</artifactid> <version>1.6.11</version> </dependency> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjtools</artifactid> <version>1.6.11</version> </dependency> </dependencies> <configuration> <source>1.6</source> <compliancelevel>1.6</compliancelevel> <verbose>true</verbose> <showweaveinfo>true</showweaveinfo> <target>1.6</target> <!-- next sets aspectj weaving path. jetserver jar has compiled aspect used weave classes in app --> <aspectlibraries> <aspectlibrary> <groupid>org.menacheri</groupid> <artifactid>jetserver</artifactid> <version>0.1</version> </aspectlibrary> </aspectlibraries> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
looks there issue version 1.6.11. when modified 1.6.1 error went away.
my pom looks like
dependencies:
<dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjrt</artifactid> <version>1.6.1</version> </dependency>
plugins:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>aspectj-maven-plugin</artifactid> <version>1.4</version> <dependencies> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjrt</artifactid> <version>1.6.1</version> </dependency> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjtools</artifactid> <version>1.6.1</version> </dependency> </dependencies> <configuration> <source>1.6</source> <compliancelevel>1.6</compliancelevel> <verbose>true</verbose> <showweaveinfo>true</showweaveinfo> <target>1.6</target> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions>
if using eclipse, next maven-eclipse-plugin configuration allows *.aj files in java src folders without issue , not clean away ajdt properties of eclipse project when doing mvn clean.
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-eclipse-plugin</artifactid> <version>2.8</version> <configuration> <ajdtversion>1.6</ajdtversion> <additionalprojectnatures> <projectnature>org.eclipse.ajdt.ui.ajnature</projectnature> <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature> <projectnature>org.eclipse.wst.common.project.facet.core.nature</projectnature> </additionalprojectnatures> <!-- source includes necessary allow aj files in java folder, else eclipse may throw filtering exception --> <sourceincludes> <sourceinclude>**/*.aj</sourceinclude> </sourceincludes> <!-- download sources create maven download , attach source files available --> <downloadsources>true</downloadsources> <downloadjavadocs>true</downloadjavadocs> </configuration>
maven aspectj
Comments
Post a Comment