5

I'm using Maven 3.0.3. I'm trying to test reading properties from a properties file (this is part of a larger effort, I wanted to get this part right first). I have this in my pom.xml file ...

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>maven-properties-plugin</artifactId>
    <version>1.0</version>
    <configuration>
      <files>
        <file>${basedir}/build.properties</file>
      </files>
    </configuration>
  </plugin>

But sadly, running "mvn properties:read-project-properties" fails with the error below. How do I need to reconfigure what I'm doing? - Dave

davea-mbp2:socialmediaproxy davea$ mvn properties:read-project-properties  
[INFO] Scanning for projects...
[WARNING] The POM for org.codehaus.mojo:maven-properties-plugin:jar:1.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.codehaus.mojo:maven-properties-plugin:1.0: Plugin org.codehaus.mojo:maven-properties-plugin:1.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:maven-properties-plugin:jar:1.0
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building socialmediaproxy 0.1
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.codehaus.mojo:maven-properties-plugin:jar:1.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.codehaus.mojo:maven-properties-plugin:1.0: Plugin org.codehaus.mojo:maven-properties-plugin:1.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:maven-properties-plugin:jar:1.0
[INFO] 
[INFO] --- properties-maven-plugin:1.0-alpha-2:read-project-properties (default-cli) @ socialmediaproxy ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.355s
[INFO] Finished at: Fri Apr 15 11:01:31 CDT 2011
[INFO] Final Memory: 11M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties (default-cli) on project socialmediaproxy: The parameters 'files' for goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties are missing or invalid -> [Help 1]
[ERROR] 
Dave
  • 8,667
  • 25
  • 72
  • 90
  • Possibly related to http://stackoverflow.com/questions/2664362/properties-maven-plugin-error-loading-properties-file – Raghuram Apr 18 '11 at 04:51

3 Answers3

2

I think you mixed up the plugin artifact setting. The correct artifact identifiers are

<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>

See: Plugin Homepage

FrVaBe
  • 47,963
  • 16
  • 124
  • 157
1
  1. Update to the current plugin version 1.0-alpha-2
  2. Make sure the build.properties file exists in the ${basedir}
  3. Either:
    • specify the goal when calling mvn with mvn properties:read-project-properties
    • Or add the goal to the pom.xml

Example pom.xml:

<build>
  <plugins>
  ...
  <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>${basedir}/build.properties</file>
          </files>
        </configuration>
      </execution>
    </executions>
  </plugin>
  ...
  </plugins>
</build>
bnjmn
  • 4,508
  • 4
  • 37
  • 52
0

Are you sure your build.properties file is in your ${basedir}?

The ${basedir} represents the directory containing pom.xml

You may reference http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide

Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
  • Hi. If you found the solution for your problem, please share. I have the exact same problem. – Muky Feb 15 '13 at 12:05