Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Maven Integration (M2E) » M2Eclipse & Multiple JVMs
M2Eclipse & Multiple JVMs [message #23856] Wed, 25 March 2009 14:17 Go to next message
Nick Sorokin is currently offline Nick SorokinFriend
Messages: 9
Registered: July 2009
Junior Member
Hi,

I 'm currently working with multi-module Maven managed application
intended to be compiled and operate with Java 1.4. However, some modules
generate Java code from application model and require Java 1.5 (at least)
to build the artefacts, mainly additional Java source. All modules can be
successfully build by Maven from the command line assuning that required
JVMs are installed.

The problems started when I tried to perform the same tasks within Eclipse
using m2eclipse plugin. The configuration I'm using consists of:
- Windows XP operating system
- Eclipse 3.4.0.v20080522
- Subclipse plugin 1.4.8 from tigris.org
- Maven integration for Eclipse 0.9.7.200902090947
- Maven2 version 2.0.7
- Java JDK 1.6.0_12 for Eclipse
- Java JDK 1.4.2_16 for application - this is configured as default for
Eclipse instance used by the application.
- Subversion 1.5.4 for code repository

What I would like to achieve is a complete clean build of the modules
within Eclipse during initial checkout of the projects from the code
repository. Unfortunately, the modules that require the JDK alternative to
default JDK fail during "Check out as Maven Project" operation from
Subversion Repository Exploring perspective. The failed project can be
successfully re-built after initial import by additional run of the Maven
build configuration where proper settings for JVM are set.

My understanding is that all Maven builds are controlled through
M2Eclipse. At the moment I can select maven profiles that wil be made
active during project checkout. So, the questions are:
1. Is it possible to specify required JVM for build in the module' pom,
e.g. specific profile or properies that can be used for maven execution?
2. If answer to Q1 is negative, then is there a maven2 plugin that will
execute another maven plugin in a separate process and will allow to
select JVM for the execution and specify the relevant parameters?

Thanks in advance - your help and suggestions will be very appreciated
Nick Sorokin
Re: M2Eclipse & Multiple JVMs [message #23898 is a reply to message #23856] Wed, 25 March 2009 15:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: igor.ifedorenko.com

To make sure I understand the problem correctly.

1. All your code, both handwritten and generated, compiles and
presumably runs with java 1.4.
2. Most of your projects can be built with java 1.4.
3. Some of your projects require java 1.5 to run the build.

If this is correct, then you need to run Eclipse with 1.5 JVM, but add
1.4 JVM in "Installed JREs" Eclipse Java preferences. During import, m2e
will set project java compliance level based on maven-compiler-plugin
configuration (which I assume is 1.4). This way m2e will use 1.5 JVM to
run the build but the code will compile and run with Java 1.4.

--
Regards,
Igor

Nick Sorokin wrote:
> Hi,
>
> I 'm currently working with multi-module Maven managed application
> intended to be compiled and operate with Java 1.4. However, some modules
> generate Java code from application model and require Java 1.5 (at
> least) to build the artefacts, mainly additional Java source. All
> modules can be successfully build by Maven from the command line
> assuning that required JVMs are installed.
>
> The problems started when I tried to perform the same tasks within
> Eclipse using m2eclipse plugin. The configuration I'm using consists of:
> - Windows XP operating system
> - Eclipse 3.4.0.v20080522
> - Subclipse plugin 1.4.8 from tigris.org
> - Maven integration for Eclipse 0.9.7.200902090947
> - Maven2 version 2.0.7
> - Java JDK 1.6.0_12 for Eclipse
> - Java JDK 1.4.2_16 for application - this is configured as default for
> Eclipse instance used by the application.
> - Subversion 1.5.4 for code repository
>
> What I would like to achieve is a complete clean build of the modules
> within Eclipse during initial checkout of the projects from the code
> repository. Unfortunately, the modules that require the JDK alternative
> to default JDK fail during "Check out as Maven Project" operation from
> Subversion Repository Exploring perspective. The failed project can be
> successfully re-built after initial import by additional run of the
> Maven build configuration where proper settings for JVM are set.
>
> My understanding is that all Maven builds are controlled through
> M2Eclipse. At the moment I can select maven profiles that wil be made
> active during project checkout. So, the questions are:
> 1. Is it possible to specify required JVM for build in the module' pom,
> e.g. specific profile or properies that can be used for maven execution?
> 2. If answer to Q1 is negative, then is there a maven2 plugin that will
> execute another maven plugin in a separate process and will allow to
> select JVM for the execution and specify the relevant parameters?
>
> Thanks in advance - your help and suggestions will be very appreciated
> Nick Sorokin
>
>
Re: M2Eclipse & Multiple JVMs [message #23940 is a reply to message #23898] Wed, 25 March 2009 16:20 Go to previous messageGo to next message
Nick Sorokin is currently offline Nick SorokinFriend
Messages: 9
Registered: July 2009
Junior Member
Thanks for quick reply.

Your assumptions are correct, but there is a requirement to use the
alternative JVM to compile the code - it is not only compliance level.
This alternative JVM may come not from Sun but e.g. from IBM. What I would
like to do is to specify at project/module level the required JVM to
run/compile the relevant parts. There also may be additional requirements
for JVM settings that need to be specified on the same basis, e.g.
different values for PermSize, etc

Regards
Re: M2Eclipse & Multiple JVMs [message #23977 is a reply to message #23940] Wed, 25 March 2009 16:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: igor.ifedorenko.com

Several issues here.

First, eclipse will always use built-in java compiler and will always
run this compiler in eclipse jvm. m2e does not have control over this.

Likewise, m2e will always use eclipse jvm when running maven during
eclipse build. Forking separate JVM is not practically feasible.

Each java project has JRE associated with it. Eclipse java compiler will
use libraries from that JRE during compilation. It is not currently
possible to tell m2e which JVM it should use. In fact, m2e configures
project classpath in such a way that you won't be able to use IBM (or
SUN) specific classes. Please submit enhancement request to m2e JIRA [1]
or add your comments to related MNGECLIPSE-1218, if you would like to
see this configurable.

You can select different JRE when running java applications or tests
from Eclipse. You can also specify JVM arguments for each launch
configuration.

[1] https://issues.sonatype.org/browse/MNGECLIPSE

--
Regards,
Igor

Nick Sorokin wrote:
> Thanks for quick reply.
>
> Your assumptions are correct, but there is a requirement to use the
> alternative JVM to compile the code - it is not only compliance level.
> This alternative JVM may come not from Sun but e.g. from IBM. What I
> would like to do is to specify at project/module level the required JVM
> to run/compile the relevant parts. There also may be additional
> requirements for JVM settings that need to be specified on the same
> basis, e.g. different values for PermSize, etc
>
> Regards
>
Re: M2Eclipse & Multiple JVMs [message #24014 is a reply to message #23977] Wed, 25 March 2009 17:03 Go to previous messageGo to next message
Nick Sorokin is currently offline Nick SorokinFriend
Messages: 9
Registered: July 2009
Junior Member
Thanks again.

With your reply in mind, how m2e will process the following definition in
the pom:

<project>
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable><!-- path-to-javac --></executable>
<compilerVersion>1.3</compilerVersion>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]
</project>

where required compiler can be specified? Will it fork to call the
compiler and what JVM will be used for that call?

My regards
Re: M2Eclipse & Multiple JVMs [message #24046 is a reply to message #24014] Wed, 25 March 2009 17:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: igor.ifedorenko.com

m2e does not (and cannot) use external java compiler, so it will just
ignore these configuration parameters. m2 only considers source/target
maven-compiler-plugin parameters.

--
Regards,
Igor

Nick Sorokin wrote:
> Thanks again.
>
> With your reply in mind, how m2e will process the following definition
> in the pom:
>
> <project>
> [...]
> <build>
> [...]
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <verbose>true</verbose>
> <fork>true</fork>
> <executable><!-- path-to-javac --></executable>
> <compilerVersion>1.3</compilerVersion>
> </configuration>
> </plugin>
> </plugins>
> [...]
> </build>
> [...]
> </project>
>
> where required compiler can be specified? Will it fork to call the
> compiler and what JVM will be used for that call?
>
> My regards
>
Re: M2Eclipse & Multiple JVMs [message #24075 is a reply to message #24046] Thu, 26 March 2009 03:49 Go to previous message
Eugene Kuleshov is currently offline Eugene KuleshovFriend
Messages: 504
Registered: July 2009
Senior Member
One thing worth to mention that this only applies to "the development
mode" when m2eclipse is configuring Eclipse tools such as JDT, AJDT and
WTP according to the configuration from pom.xml. This is how you
normally code and debug your application, run unit tests (with Run as...
/ JUnit test) or run on web app server (Run as... / Server app).

However if you use Run as... / Maven build..., or create corresponding
launch config from the Run/Debug menu, then you can select JVM that is
used to launch Maven and all your compiler configuration will be
respected in the same way it is respected in the command line.

regards,
Eugene



Igor Fedorenko wrote:
> m2e does not (and cannot) use external java compiler, so it will just
> ignore these configuration parameters. m2 only considers source/target
> maven-compiler-plugin parameters.
>
> --
> Regards,
> Igor
>
> Nick Sorokin wrote:
>> Thanks again.
>>
>> With your reply in mind, how m2e will process the following
>> definition in the pom:
>>
>> <project>
>> [...]
>> <build>
>> [...]
>> <plugins>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-compiler-plugin</artifactId>
>> <configuration>
>> <verbose>true</verbose>
>> <fork>true</fork>
>> <executable><!-- path-to-javac --></executable>
>> <compilerVersion>1.3</compilerVersion>
>> </configuration>
>> </plugin>
>> </plugins>
>> [...]
>> </build>
>> [...]
>> </project>
>>
>> where required compiler can be specified? Will it fork to call the
>> compiler and what JVM will be used for that call?
>>
>> My regards
>>
Previous Topic:Installing M2E Source & Development Environment
Next Topic:Add Dependecy?
Goto Forum:
  


Current Time: Tue Apr 16 21:07:03 GMT 2024

Powered by FUDForum. Page generated in 0.73056 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top