I am working on a fairly big Maven project, and develop in Java with Eclipse.
To save compilation time, I would like Maven and Eclipse to share the same target, which I managed to do. However when I compile with Maven, Eclipse lacks some stuff that it puts in the bytecode, so it recompiles everything (from what I understand). I am talking about the "build automatically" feature here, so it is not Eclipse delegating the build to Maven.
To solve this, I thought I would ask Maven to use the same compiler as Eclipse.
After some search on the web, I found out I could add this in the top pom
:
<build>
...
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerId>eclipse</compilerId>
<source>1.5</source>
<target>1.5</target>
<optimize>true</optimize>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
This seems to work, but the build fails fairly quickly with lots of errors, while it succeeds with javac. I'm not sure why, but it seems that there is some conflicts linked to the fact the failing Java files are generated files.
So I thought I could try to use the Eclipse compiler only for the
component I am working on (which does not have that kind of generated
files). I added the above snippet in the pom
of my component, but when
the build reaches my component, the following error is raised:
No such compiler 'eclipse'
I also tried to add the plexus-compiler-eclipse
dependency in the
dependencies listed in the top pom, but same error.
Do you know if what I am trying to do is possible? Any hint of how I can do it?