Transfer variables from the properties file to the distribution. Control tag in pom.xml

So, I have something like:

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>properties-maven-plugin</artifactId>
            <version>1.0-alpha-1</version>
            <executions>
                <execution>
                    <phase>initialize</phase>
                    <goals>
                        <goal>read-properties</goal>
                    </goals>
                    <configuration>
                        <files>
                            <file>${user.home}/build.properties</file>
                        </files>
                    </configuration>
                </execution>
            </executions>
        </plugin>

and I have distributionManagementlike:

<distributionManagement>
    <repository>
        <id>local-repo</id>
        <url>file:///${deploy.dir}/${project.artifactId}</url>
    </repository>
</distributionManagement>

I do not have a remote repository, so I do this with file:///

${deploy.dir}is a property from the file build.properties, and it will not take values ​​for this property. Why?

+3
source share
2 answers

, , , , , . , , , , maven, <distributionManagement>, POM.

( OP.)

+2

. :

<profiles>
   <profile>
      <id>repo1</id>
      <distributionManagement>
         <repository>
            <id>repo1-release</id>
            <url>http://.......</url>
         </repository>
      </distributionManagement>
   </profile>

   <profile>
      <id>repo2</id>
      <distributionManagement>
         <repository>
            <id>repo2-release</id>
            <url>http://.......</url>
         </repository>
      </distributionManagement>
   </profile>
   ..
</profiles>

, :

mvn -Prepo1 clean deploy
+4

All Articles