| Summary: | otdt maven integration fails to build plain maven java project | ||
|---|---|---|---|
| Product: | [Tools] Objectteams | Reporter: | Ivica Loncar <iloncar.ml> |
| Component: | OTMvn | Assignee: | Project Teams <objectteams.otdt-inbox> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | stephan.herrmann |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Ivica Loncar
Mh, that's interesting.
The simplest workaround I can see right now is to add the following
to your plain-Java projects:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerId>jdt</compilerId>
</configuration>
</plugin>
</plugins>
</build>
This will tell the maven-compiler-plugin to use the JDT compiler for this
project. Now the existing lifecycle mapping will match the used compiler.
Without the flavor otj declaration the compiler will only accept plain Java.
But note, that within the OTDT this will still be the OT/J version of the
compiler.
During my first experiments I did not succeed to let the
maven-compiler-plugin use different compilers (jdt & javac) within the
same workspace. Checking again today I find that a Java project can indeed
use javac even with ot.mvn installed by specifying:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerId>javac</compilerId>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<versionRange>
[2.3.2,)
</versionRange>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<configurator>
<id>org.eclipse.m2e.jdt.javaConfigurator</id>
</configurator>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
This is still only a workaround. I'll leave this bug open for
investigating ways to support plain Java without additional tweaks but
still provide the option to manage OT/J projects, too.
Please also let me know if these workarounds don't work for you.
I found a better way to support the jdt compiler without breaking support for javac. Please update org.eclipse.objectteams.mvn to 1.0.0.201109010126. With this update the plain Java project should work again with or without mentioning the maven-compiler-plugin. Feel free to re-open if the issue is not solved for you. (not setting a target milestone as this plugin is still early access). Yep. It seems to work. (In reply to comment #3) > Yep. It seems to work. Thanks for confirming. |