M2Eclipse & Multiple JVMs [message #23856] |
Wed, 25 March 2009 10:17  |
Eclipse User |
|
|
|
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 11:40   |
Eclipse User |
|
|
|
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 #24075 is a reply to message #24046] |
Wed, 25 March 2009 23:49  |
Eclipse User |
|
|
|
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
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03726 seconds