Community
Participate
Working Groups
Build Identifier: 20110615-0604 We use the buildnumber plugin to put a timestamp into a properties file and it doesn't work anymore in Eclipse after we've upgraded to m2e 1.0 (works fine from the command line). According to Igor it's a more global problem with "project properties set by one mojo are not visible to mojos executed later in the build lifecycle". Reproducible: Always Steps to Reproduce: To reproduce yourself, create an app.properties with the following contents: buildnumber=${buildNumber} project.version=${project.version} And then put the following in your pom.xml: <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>app.properties</include> </includes> </resource> </resources> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>1.0-beta-1</version> <!-- can't update to newer version due to MOJO-1463 --> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>create</goal> </goals> </execution> </executions> <configuration> <format>{0,date,yyMMddHHmm}</format> <items> <item>timestamp</item> </items> </configuration> </plugin> </plugins> </build> ${project.version} gets resolved fine, from Eclipse or the command line, but ${buildNumber} only gets resolves if run from the command line. I've tried every phase I can think of, to no avail.
This is closely related or the same as Bug 349586
*** This bug has been marked as a duplicate of bug 349586 ***
Created attachment 204400 [details] complete standalone example project I've attached a complete standalone example project that demonstrates that m2e 1.1 executes buildnumber-maven-plugin during workspace build and makes ${buildNumber} property available to other maven plugins (resources-plugin in this example). Beware that buildnumber-maven-plugin generates new property value on each execution, which is likely not the desired behaviour inside eclipse works.
Thanks, adding the following XML to the testcase's POM did the trick: <pluginManagement> <plugins> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <versionRange>[0,)</versionRange> <goals> <goal>create</goal> </goals> </pluginExecutionFilter> <action> <execute> <runOnConfiguration>true</runOnConfiguration> <runOnIncremental>true</runOnIncremental> </execute> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement> Is that going to be documented somewhere? I doubt many developers are going to think to do that when they encounter this issue :/. Changing every execution is fine for my uses :)
Moved to https://github.com/eclipse-m2e/m2e-core/issues/