Hello,

This is the situation I'm in.

I have this structure

pom.xml (root)
|_ pom.xml (module A)
|_ pom.xml (module B)

These are (excerpts) of the poms

pom.xml (root)
    <groupId>rootGroupId</groupId>
    <artifactId>rootArtifactId</artifactId>
    <packaging>pom</packaging>
    <version>${rootGroupId}</version>

    <modules>
      <module>moduleA</module>
      <module>moduleB</module>
   </modules>

<properties>
  <moduleAGroupId>1.0-SNAPSHOT</moduleAGroupId>
  <moduleBGroupId>1.0-SNAPSHOT</moduleBGroupId>
  <rootGroupId>rootVersion</rootGroupId>
</properties>

pom (module A)

    <parent>
        <groupId>rootGroupId</groupId>
        <artifactId>rootArtifactId</artifactId>
        <version>${rootGroupId}</version>
    </parent>

    <groupId>moduleAGroupId</groupId>
    <artifactId>moduleAArtifactId</artifactId>
    <packaging>pom</packaging>
    <version>${moduleAGroupId}</version>

pom (module B)

    <parent>
        <groupId>rootGroupId</groupId>
        <artifactId>rootArtifactId</artifactId>
        <version>${rootGroupId}</version>
    </parent>

    <groupId>moduleBGroupId</groupId>
    <artifactId>moduleBArtifactId</artifactId>
    <packaging>pom</packaging>
    <version>${moduleBGroupId}</version>

   <dependencies>
     <dependency>
         <groupId>moduleAGroupId</groupId>
         <artifactId>moduleAArtifactId</artifactId>
        <version>${moduleAGroupId}</version>
     <dependency>
  </dependency>

cd root
mvn install

------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------

cd moduleB
mvn install

[WARNING] Unable to get resource
'moduleAGroupId:moduleAArtifactId:${moduleAGroupId}'
from repository central (http://repo1.maven.org/maven2): Error
transferring file: Server returned HTTP response code: 500 for URL:
http://<pom_maven_repo_location>
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: moduleB

Reason: Cannot find parent: moduleA pom for project: moduleB

This is happening because when building moduleA its pom file is 
installed in the maven repo without filtering, i.e, as it is with ${}. 
When the pom is retrieved to satisfy moduleB dependency on moduleA it's 
retrieved as

<groupId>moduleAGroupId</groupId>
<artifactId>moduleAArtifactId</artifactId>
<packaging>pom</packaging>
<version>${moduleAGroupId}</version>

where ${moduleAGroupId} is not instanciated, hence the error.

My question is:
1. Could I force maven to store the pom files **filtered** or
2. How can maven be forced to instantiate ${moduleAGroupId} upon 
retrieval from the maven repo so moduleB dependency can be satisfied
3. What other alternative do I have to solve this scenario without 
giving up using ${} in <version>


      


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to