Thursday, October 27, 2011

Replacing javac with eclipse compiler in Maven

I was working on a Java project with eclipse where I used cyclic dependencies. Specifically I implemented the Reverse MVP pattern with GWT Platform. Everything went well in as long as I was using eclipse to compile the project, but once I tried to use Maven to compile the project, I got compilation errors for every case where I had a cyclic dependency. I figured that if eclipse is good enough to compile the sources in development time, it might as well be used in build time instead of JDK's javac. Here is the maven-compiler-plugin configuration from the project POM I initially had:

   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   2.3.2
   
      <source>1.6</source>
      1.6
   
In order to replace javac with eclipse compiler we need to do two things: we need to add a dependency for plexus-compiler-eclipse, and we need to tell the maven-compiler-plugin to use the eclipse compiler as described here. Here is the updated configuration:

   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   2.3.2
   
      <compilerId>eclipse</compilerId>
      <source>1.6</source>
      1.6
   
   
      
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-compiler-eclipse</artifactId>
         1.8.2
      
   
After that it was possible to build the project with Maven.

12 comments:

  1. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man, Keep it up.


    Java Training in Chennai

    Java Course in Chennai

    ReplyDelete
  2. Fabulous, what a weblog it is! This blog provides valuable information to us, keep it up.

    Java Training in Chennai

    Java Course in Chennai

    ReplyDelete
  3. I found for that excuse many enticing stuff in your blog especially its ventilation. From the heaps of remarks a propos your articles, I surmise I'm as of now not the independent one having all of the relaxation here! shop occurring the charming complete.. Microsoft Office Crack Version

    ReplyDelete
  4. i'm honest natured you take conveyance of to self-centeredness in your message. It makes you stand dependancy out from numerous assistant essayists that can't uphold extreme climate content remembering you. Office 2019 Crack

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. But despite all the joys of the Christmas season (and as wonderful as your wife truly is!), writing that Christmas greeting card can sometimes be a little .
    Christmas Love Words

    ReplyDelete
  7. MBit Casino was also launched in 2014, nevertheless it became well-known inside a year due to its slot machines. The major cause for its success was the free slots permitting people to always have some cash to play extra 1xbet and earn extra. As nicely as developing thought-provoking on-line slot video games that obtain big success globally, BTG is the inventor of the Megaways™ slots recreation mechanic. Megaways™, a tiered, linked, progressive jackpot prize system, modified the complete market with 117,649 methods to win. It is now licensed to giant number of|numerous|a lot of} recreation developers worldwide.

    ReplyDelete