Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

properties-maven-plugin not working for goal write-project-properties

I need to export property values from mvn command line to a file which is needed for my java code later. But i always get the error:

[ERROR] Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:write-project-properties (default-cli) on project MyApplication: The parameters 'outputFile' for goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:write-project-properties are missing or invalid -> [Help 1] [ERROR]

Here is my project structure

MyApplication
|src/main/java
|src/main/resources
|src/test/java
|src/test/resources
|lib          ////(no files here yet)
|pom.xml

And my pom.xml is:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <version>1.0-alpha-2</version>
    <executions>
        <execution>
            <phase>test</phase>
            <goals>
                <goal>write-project-properties</goal>
            </goals>
            <configuration><outputFile>${basedir}/lib/build.properties</outputFile>
            </configuration>
        </execution>
    </executions>
</plugin>

Note: I tried by manually creating empty file build.properties in lib folder and even same error. Tried with plugin version 1.0.0 too.

like image 984
Bhuvanesh Mani Avatar asked Oct 16 '25 14:10

Bhuvanesh Mani


1 Answers

OK, after hours of trying different combinations, (moved <configuration> above/out of <executions>)in pom.xml, i see now lib/build.properties file created. But can someone explain this please?

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                 <version>1.0-alpha-2</version>
                <configuration>
                    <outputFile>${basedir}/lib/build.properties</outputFile>
                </configuration>
                <executions>
                    <execution>
                        <id>write-project-properties</id>
                        <goals>
                            <goal>write-project-properties</goal>
                        </goals>
                        <phase>test</phase>
                    </execution>
                </executions>
            </plugin>
like image 121
Bhuvanesh Mani Avatar answered Oct 18 '25 14:10

Bhuvanesh Mani