Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Build result using m2e and maven not the same

I'm running into a problematic issue with m2e and Eclipse (vs command line maven build).  I am using a clean installation of Luna WTP 4.4.2 with m2e 1.5.1.

I have aspectj-maven-plugin configured in my pom.xml and the connector installed as well.

My plugin configuration specifies:

               <executions>
                    <execution>
                    <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                        <sources>
                      <source>
                      <basedir>${project.build.sourceDirectory}</basedir>
                      </source>
                        </sources>
                        </configuration>
                    </execution>
                    <execution>
                    <id>test compile</id>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                       <sources>
                      <source>
                      <basedir>${project.build.testSourceDirectory}</basedir>
                      </source>
                       </sources>
                      <weaveDirectories>
                      <param>${project.build.outputDirectory}</param>
                      </weaveDirectories>
                        </configuration>
                    </execution>
                </executions>

The goal is to have an aspect from my src/test/java path woven into my classes from src/main/java but output only in my target/test-classes.  The reasoning behind this is that the aspect is only used for junit testing and not for normal code compilation/use.

When I build from the command line, everything works properly.  The "compile" goal compiles & weaves all my src/main/java files to the target/classes output directory and the "test-compile" compiles & weaves all my src/test/java files into target/test-classes.

However, when I build from within Eclipse, my Aspects in src/test/java are woven into classes in target/classes as well.  Additionally, only the files from src/test/java are output into target/test-classes while the pom instructs ajc to do otherwise (weave all class files from target/classes into target/test-classes).

I've enabled debug from cmd line when I build (mvn -X) and I can see appropriate parameters passed to the aspectj-maven-plugin.  However when I enable debug logging from .metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.${m2e.version}.xml, I do not see the parameters that are being passed to the aspectj-maven-plugin.

Does this have something to do with the lifecycle mapping connector? Is there a way to debug how that is working?

I uploaded my sample project to my github:
https://github.com/benze/aspectj-maven-plugin-defect-example

Thanks,
Eric


Back to the top