Maven properties in a multi-module reset project by default

I have a question regarding properties in a multi-module project.

Consider the following three-level project:

project
+- pom.xml (packaging: pom)        //referred to as super-pom
+- module_group
   +- pom.xml (packaging: pom)     //referred to as group-pom
   +- module
      +-pom.xml (packaging: jar)   //referred to as module-pom

In super-pom, I define a version of a property that gets the default value of "unknown".

In addition, I declare and use buildnumber-maven-pluginwhich is configured to receive the svn revision and puts it in the property revision.

Then I configure maven-jar-pluginto write this property to the manifest.

In the pom module, I declare the use buildnumber-maven-pluginso that it actually executes.


All this works with the direct construction of the module, i.e. Only when executing the pump module. The manifest contains the patch reported buildnumber-maven-pluginas shown on the console.

, -pom group-pom, , buildnumber-maven-plugin, ( maven-jar-plugin ).

, , - .

- , ? - , ( , )?

Update

(-X) , , , :

1) pom parsing , pom, .

pom:

<!-- declare the property default value -->
<properties>
  <revision>default</revision>
</properties>

...

<!-- use the property -->
<someconfig>${revision}</someconfig>

pom , , , :

<properties>
  <revision>default</revision>
</properties>

...

<!-- The property seems to be "statically" replaced -->
<someconfig>default</someconfig>

2) , , , validate.

, , .

3) , <someconfig> ( maven-jar-plugin), <someconfig>default</someconfig> , , revision.

- ?

+5
1

, buildnumber-maven-plugin maven-jar-plugin - , , .

- ( ):

        <!-- Generate build number -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>buildnumber-maven-plugin</artifactId>
            <version>1.0</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>create</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <doCheck>false</doCheck>
                <doUpdate>false</doUpdate>
            </configuration>
        </plugin>
        <!-- Attach build number to all jars -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.1</version>
            <configuration>
                <archive>
                    <manifest>
                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                    </manifest>
                    <manifestEntries>
                        <Implementation-Build>${buildNumber}</Implementation-Build>
                        <Implementation-Build-Timestamp>${maven.build.timestamp}</Implementation-Build-Timestamp>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
0

All Articles