You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Romain Thouvenin <ro...@gmail.com> on 2011/06/23 18:42:20 UTC

Use the eclipse compiler in a maven component

Hello,

I am working on a fairly big maven project, and develop in Java with Eclipse.

To save compilation time, I would like that maven and eclipse 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 understood).

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?

Sorry if the question seems dumb, I am not a maven expert, and I am
not the one who designed the whole maven architecture of our project.
And sorry for the long message, I wanted to give the whole context...


Thanks a lot for your help!

Romain

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Use the eclipse compiler in a maven component

Posted by Romain Thouvenin <ro...@gmail.com>.
Not sure I understand. The config you gave won't make maven use the
JDT compiler, will it?

Regards,
Romain

On Thu, Jun 23, 2011 at 7:15 PM, Yuvaraj Vanarase
<yu...@synechron.com> wrote:
> Use inside POM:
>
> <plugin>
>                                <groupId>org.apache.maven.plugins</groupId>
>                                <artifactId>maven-compiler-plugin</artifactId>
>                                <configuration>
>                                        <source>1.6</source>
>                                        <target>1.6</target>
>                                        <meminitial>128m</meminitial>
>                                        <maxmem>512m</maxmem>
>                                </configuration>
>                        </plugin>
>
> Set same java version in eclipse for compilation. Also, modify build path of eclipse project to set output directory as 'target'.
>
>
> Regards,
> Yuvaraj
>
> Yuvaraj Vanarase,
> Lead Technology - Software
> Phone: +91.20.40262000 Ext 2305|Mobile: +91.9850818870 | http://www.synechron.com
> SYNECHRON -
> - Top 10 Best IT Employers for 4 consecutive years (link).
> - Celebrating 10 Years!
>
>
> -----Original Message-----
> From: Romain Thouvenin [mailto:romain.thouvenin@gmail.com]
> Sent: Thursday, June 23, 2011 10:12 PM
> To: users@maven.apache.org
> Subject: Use the eclipse compiler in a maven component
>
> Hello,
>
> I am working on a fairly big maven project, and develop in Java with Eclipse.
>
> To save compilation time, I would like that maven and eclipse 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 understood).
>
> 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?
>
> Sorry if the question seems dumb, I am not a maven expert, and I am
> not the one who designed the whole maven architecture of our project.
> And sorry for the long message, I wanted to give the whole context...
>
>
> Thanks a lot for your help!
>
> Romain
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Use the eclipse compiler in a maven component

Posted by Yuvaraj Vanarase <yu...@synechron.com>.
Use inside POM:

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
					<meminitial>128m</meminitial>
					<maxmem>512m</maxmem>
				</configuration>
			</plugin>

Set same java version in eclipse for compilation. Also, modify build path of eclipse project to set output directory as 'target'.


Regards,
Yuvaraj

Yuvaraj Vanarase,
Lead Technology - Software
Phone: +91.20.40262000 Ext 2305|Mobile: +91.9850818870 | http://www.synechron.com
SYNECHRON - 
- Top 10 Best IT Employers for 4 consecutive years (link).
- Celebrating 10 Years!


-----Original Message-----
From: Romain Thouvenin [mailto:romain.thouvenin@gmail.com] 
Sent: Thursday, June 23, 2011 10:12 PM
To: users@maven.apache.org
Subject: Use the eclipse compiler in a maven component

Hello,

I am working on a fairly big maven project, and develop in Java with Eclipse.

To save compilation time, I would like that maven and eclipse 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 understood).

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?

Sorry if the question seems dumb, I am not a maven expert, and I am
not the one who designed the whole maven architecture of our project.
And sorry for the long message, I wanted to give the whole context...


Thanks a lot for your help!

Romain

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org