You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rusty Wright <ru...@gmail.com> on 2008/12/05 20:36:38 UTC
properties substitution problem in pom
There's something about properties substition that I don't understand.
I'm getting the error about a missing artifact, the coordinates for the artifact it's complaining about are
jdbc-groupId-placeholder:jdbc-artifactId-placeholder:jar:version-jdbc-placeholder
And the path message is
Path to dependency:
1) edu.berkeley.ist.cars:cars-war:war:1.1-SNAPSHOT
2) edu.berkeley.ist.cars:cars-web:jar:1.1-SNAPSHOT
3) edu.berkeley.ist.cars:cars-download:jar:1.1-SNAPSHOT
4) jdbc-groupId-placeholder:jdbc-artifactId-placeholder:jar:version-jdbc
The cars-web and cars-download are built from a multi module parent pom, which contains (along with the usual stuff)
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${version.jdbc}</version>
</dependency>
<!-- etc. -->
</dependencies>
</dependencyManagement>
<properties>
<jdbc.groupId>jdbc-groupId-placeholder</jdbc.groupId>
<jdbc.artifactId>jdbc-artifactId-placeholder</jdbc.artifactId>
<version.jdbc>version-jdbc-placeholder</version.jdbc>
<!-- etc. -->
</properties>
<profiles>
<profile>
<id>test</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<jdbc.driverClass>com.mysql.jdbc.Driver</jdbc.driverClass>
<jdbc.groupId>mysql</jdbc.groupId>
<jdbc.artifactId>mysql-connector-java</jdbc.artifactId>
<version.jdbc>5.1.6</version.jdbc>
<!-- etc. -->
</properties>
</profile>
</profiles>
I'm getting the error when I run "mvn -Ptest package" in the cars-war directory.
In the cars-parent directory I did "mvn -Ptest clean package install" and it installed the jars in my ~/.m2 repo.
The cars-war pom.xml only has a dependency on cars-web.
The pom for cars-download contains
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
</dependency>
(When I look at the .pom files in my ~/.m2 repo for cars-download and the parent they contain the ${} placeholders, not the substituted values, which puzzles me.)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: properties substitution problem in pom
Posted by Rusty Wright <ru...@gmail.com>.
I got it to work by being less aggressive about using property placeholders; now the dependencyManagement dependencies use a specific groupId and artifactId. Likewise for the dependency section in the cars-download pom. But I'm still confused about why it wasn't working. It seems like it's not using the properties I gave in the profile.
Rusty Wright wrote:
> There's something about properties substition that I don't understand.
>
> I'm getting the error about a missing artifact, the coordinates for the
> artifact it's complaining about are
>
> jdbc-groupId-placeholder:jdbc-artifactId-placeholder:jar:version-jdbc-placeholder
>
>
> And the path message is
>
> Path to dependency:
> 1) edu.berkeley.ist.cars:cars-war:war:1.1-SNAPSHOT
> 2) edu.berkeley.ist.cars:cars-web:jar:1.1-SNAPSHOT
> 3) edu.berkeley.ist.cars:cars-download:jar:1.1-SNAPSHOT
> 4)
> jdbc-groupId-placeholder:jdbc-artifactId-placeholder:jar:version-jdbc
>
> The cars-web and cars-download are built from a multi module parent pom,
> which contains (along with the usual stuff)
>
> <dependencyManagement>
> <dependencies>
> <dependency>
> <groupId>${jdbc.groupId}</groupId>
> <artifactId>${jdbc.artifactId}</artifactId>
> <version>${version.jdbc}</version>
> </dependency>
> <!-- etc. -->
> </dependencies>
> </dependencyManagement>
> <properties>
> <jdbc.groupId>jdbc-groupId-placeholder</jdbc.groupId>
> <jdbc.artifactId>jdbc-artifactId-placeholder</jdbc.artifactId>
> <version.jdbc>version-jdbc-placeholder</version.jdbc>
> <!-- etc. -->
> </properties>
> <profiles>
> <profile>
> <id>test</id>
>
> <activation>
> <activeByDefault>false</activeByDefault>
> </activation>
>
> <properties>
> <jdbc.driverClass>com.mysql.jdbc.Driver</jdbc.driverClass>
> <jdbc.groupId>mysql</jdbc.groupId>
> <jdbc.artifactId>mysql-connector-java</jdbc.artifactId>
> <version.jdbc>5.1.6</version.jdbc>
> <!-- etc. -->
> </properties>
> </profile>
> </profiles>
>
> I'm getting the error when I run "mvn -Ptest package" in the cars-war
> directory.
>
> In the cars-parent directory I did "mvn -Ptest clean package install"
> and it installed the jars in my ~/.m2 repo.
>
> The cars-war pom.xml only has a dependency on cars-web.
>
> The pom for cars-download contains
>
> <dependency>
> <groupId>${jdbc.groupId}</groupId>
> <artifactId>${jdbc.artifactId}</artifactId>
> </dependency>
>
> (When I look at the .pom files in my ~/.m2 repo for cars-download and
> the parent they contain the ${} placeholders, not the substituted
> values, which puzzles me.)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org