Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parent version ${revision} is not resolved if parent is from remote source #2

Open
vasu-vi opened this issue Aug 28, 2019 · 1 comment

Comments

@vasu-vi
Copy link

vasu-vi commented Aug 28, 2019

Hi, I followed this url https://jeanchristophegay.com/maven-unique-version-multi-modules-build-en/ and a couple of other stackoverflow questions. I have a simple parent-child setup, where child references parent as a different project (child is not a module of parent).

Parent:

  <artifactId>parent</artifactId>
  <packaging>pom</packaging>
  <version>${revision}</version>

  <properties>
    <revision>1.0.0</revision>
  </properties>

Child:

<parent>
    <groupId>com.test</groupId>
    <artifactId>parent</artifactId>
    <version>${revision}</version>
    <relativePath/>
  </parent>

  <artifactId>child</artifactId>
  <packaging>pom</packaging>
  <version>${revision}</version>
  <build>
       <extensions>
        <extension>
          <groupId>fr.jcgay.maven.extension</groupId>
          <artifactId>unique-revision-maven-filtering</artifactId>
          <version>1.1</version>
        </extension>
        </extensions>
  </build>

I also have the .mvn/extensions.xml.

parent is installed properly in localrepo. When I run for child, mvn -Drevision=1.0.0 clean install , the parent's ${revision} is not being resolved. Instead I get:

[ERROR] Non-resolvable parent POM for com.test:child:${revision}: Failure to find com.test:parent:pom:${revision} in $NEXUS_URL/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced and 'parent.relativePath' points at no local POM @ line 6, column 11 ->

I tried with mvn -X, I can see the extension is being touched

[DEBUG] fr.jcgay.maven.extension:unique-revision-maven-filtering:jar:1.1:
[DEBUG] Populating class realm coreExtension>fr.jcgay.maven.extension:unique-revision-maven-filtering:1.1
[DEBUG] Included /m361/m2_repo/fr/jcgay/maven/extension/unique-revision-maven-filtering/1.1/unique-revision-maven-filtering-1.1.jar

I dont see a target/pom.xml either. If I change parent's version to 1.0.0, the target/pom.xml is generated fine, but there is no need for ${revision} then.

At what point of time does the extension kick-in during the build lifecycle? It appears mvn is attempting to resolve parent.version before the extension gets a chance to replace it.

Any help appreciated.

@jcgay
Copy link
Owner

jcgay commented Sep 2, 2019

Hi,

I'm not sure to understand exactly what you are doing, can you create a simple repository to reproduce your configuration and steps ?

This extension only replaces the ${revision} by the resolved version of the property in phases install (within the maven-install-plugin) and deploy (within the maven-deploy-plugin).

This now can also be done by following https://maven.apache.org/maven-ci-friendly.html Install/Deploy section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants