Hi,

I did following testing, and get reproducible result:

$ mvn -gs settings-placeholder-in-central-repo-url.xml -f
pom-without-partent.xml clean
Downloading: 
http://localhost:9001/public/releases/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom

$ mvn -gs settings-placeholder-in-central-repo-url.xml -f
pom-with-partent.xml clean
Downloading: ${centralRepoUrl}/org/apache/apache/7/apache-7.pom

You can see that the place holder isn't replaced for pom with parent
defined. And in both case, the place holder in localRepository section
never get replaced correctly (you will have a folder named
"${project.build.directory}" in current build folder).

Do we have the best practice: DO NOT use place holder in repository
management except deployment?


Those xml files are in attachment and you can guess what's inside by
it's name. In the test, maven version is 3.0.1. Maven 2.2.1 has
slightly different but unexpected result as well.


Thanks!

-Guo
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.duguo.maven.community</groupId>
	<artifactId>pom-without-parent</artifactId>
	<version>1.0.0-SNAPSHOT</version>
</project>
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.apache</groupId>
		<artifactId>apache</artifactId>
		<version>7</version>
	</parent>
	<groupId>org.duguo.maven.community</groupId>
	<artifactId>pom-with-parent</artifactId>
	<version>1.0.0-SNAPSHOT</version>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"; 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd";>
  <localRepository>${project.build.directory}/localrepo</localRepository>
  <profiles>
    <profile>
      <id>alwaysActiveProfile</id>
      <properties>
        <centralRepoUrl>http://localhost:9001/public/releases</centralRepoUrl>
      </properties>
      <repositories>
        <repository>
          <id>central</id>
          <url>${centralRepoUrl}</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>${centralRepoUrl}</url>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
  </activeProfiles>
</settings>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to