Maven 3 / properties-maven-plugin
Case
Maven 3 is stricter than Maven 2 on pom.xml compliancy with Maven’s XSD.
This induces more errors when a project is upgraded from Maven 2 to Maven 3.
For instance, I had the following block in my pom.xml
:
[xml]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>conf/deployment/${maven.user}.pom.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>[/xml]
I got this errors, related to properties-maven-plugin
:
[java]Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties (default-cli) on project jonathan-lalou-web: The parameters ‘files’ for goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties are missing or invalid -> [Help 1][/java]
Initially, I thought the propery maven.user
was not dynamically set. This is why I wrote the actual path in hard. But I got that error:
[java]The parameters ‘files’ for goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties are missing or invalid[/java]
Quick Fix
As a quick fix, I made the block a little lighter:
[xml]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<configuration>
<files><file>conf/deployment/jlalou.pom.properties</file></files>
</configuration>
</plugin>[/xml]
This is a quick and dirty fix:
- I cannot configure the execution and restrict the plugin use to a single phase, as it was
- I have to run explicitly the goal. I mean: before, I ran
mvn package weblogic:deploy
, and now I have to runmvn org.codehaus.mojo:properties-maven-plugin:read-project-properties package com.oracle.weblogic:weblogic-maven-plugin:deploy
(since I have upgraded Weblogic plugin at the same time)