You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2012/03/25 14:29:41 UTC

cgen and newer M2Eclipse plugin

I just had some problems with cgen declaration in the POM after upgrading to 1.0 version of M2Eclipse plugin. Turns out Cayenne projects now need the following declaration in the POM for the plugin to correctly work with cgen. This does not affect the command line build, only the behavior within Eclipse. 

See http://wiki.eclipse.org/M2E_plugin_execution_not_covered for more details.

We may need to contribute an extension to M2Eclipse, so that it recognizes Cayenne out of the box without this hack in the future. For now add this to your poms.

Andrus


<build>
	<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.cayenne.plugins</groupId>
									<artifactId>maven-cayenne-plugin</artifactId>
									<versionRange>[1.0,)</versionRange>
									<goals>
										<goal>cgen</goal>
									</goals>
								</pluginExecutionFilter>
								<action>
									<execute />
								</action>
							</pluginExecution>
						</pluginExecutions>
					</lifecycleMappingMetadata>
				</configuration>
			</plugin>
		</plugins>
	</pluginManagement>
</build>

Re: cgen and newer M2Eclipse plugin

Posted by Andrus Adamchik <an...@objectstyle.org>.
Sorry, I forgot to mention one step - after the M2Eclipse upgrade projects would lose their Maven "nature". So after adding XML below to the pom, I had to right-click the project and do "Configure > Convert to Maven Project". The result was that Eclipse metadata files are now compatible with both new and old versions of M2Eclipse. Here is a trimmed diff from upgrade commit to give you an idea:

--- .classpath	2012-03-15 14:35:48 UTC (rev 40403)
+++ .classpath	2012-03-15 14:41:26 UTC (rev 40404)
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">


--- .project	2012-03-15 14:35:48 UTC (rev 40403)
+++ .project	2012-03-15 14:41:26 UTC (rev 40404)
@@ -29,8 +29,14 @@
			<arguments>
			</arguments>
		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
	</buildSpec>
	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>


Andrus

---------------
Andrus Adamchik
Apache Cayenne ORM: http://cayenne.apache.org/
Twitter: http://twitter.com/andrus_a


On Mar 25, 2012, at 3:29 PM, Andrus Adamchik wrote:

> I just had some problems with cgen declaration in the POM after upgrading to 1.0 version of M2Eclipse plugin. Turns out Cayenne projects now need the following declaration in the POM for the plugin to correctly work with cgen. This does not affect the command line build, only the behavior within Eclipse. 
> 
> See http://wiki.eclipse.org/M2E_plugin_execution_not_covered for more details.
> 
> We may need to contribute an extension to M2Eclipse, so that it recognizes Cayenne out of the box without this hack in the future. For now add this to your poms.
> 
> Andrus
> 
> 
> <build>
> 	<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.cayenne.plugins</groupId>
> 									<artifactId>maven-cayenne-plugin</artifactId>
> 									<versionRange>[1.0,)</versionRange>
> 									<goals>
> 										<goal>cgen</goal>
> 									</goals>
> 								</pluginExecutionFilter>
> 								<action>
> 									<execute />
> 								</action>
> 							</pluginExecution>
> 						</pluginExecutions>
> 					</lifecycleMappingMetadata>
> 				</configuration>
> 			</plugin>
> 		</plugins>
> 	</pluginManagement>
> </build>