Maven Ant Tasks
  1. Maven Ant Tasks
  2. MANTTASKS-87

Using a pom.xml for dependencies, in which the pom.xml has a parent pom.xml will cause a "Error downloading parent pom" error

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.9
    • Fix Version/s: 2.0.10
    • Component/s: pom task
    • Labels:
      None
    • Environment:
      WindowsXP
      Ant version 1.7.0
    • Number of attachments :
      2

      Description

      Using a pom.xml for dependencies, in which the pom.xml has a parent pom.xml will cause a "Error downloading parent pom" error.

      This WAS NOT a bug with version 2.0.6 of the maven-ant-tasks (new issue to maven-ant-tasks-2.0.7.jar and still an issue with the latest maven-ant-tasks-2.0.8-SNAPSHOT.jar (as of the writting of this bug)).

      Just to see if I had done something wrong with the pom.xml file I tried to run a Maven goal against the pom.xml file. I found that if I run "mvn clean" from this same directory (where the build.xml and pom.xml file is located), using Maven-2.0.7, I get a build successfull (it was able to find the parent pom.xml file... so this seems to be isolated to JUST the maven-ant-task not being able to find the parent pom.xml)

            • Sample of the pom.xml file ****
              <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/maven-v4_0_0.xsd">
              <modelVersion>4.0.0</modelVersion>
              <groupId>intuit.sbconnect</groupId>
              <artifactId>sbclogin</artifactId>
              <version>1.0.3</version>
              <name>SBCLogin</name>

      <parent>
      <groupId>mygroup</groupId>
      <artifactId>CommonPOM</artifactId>
      <version>1.0.2</version>
      </parent>

      <dependencies>
      <dependency>
      <groupId>myothergroup</groupId>
      <artifactId>myartifact</artifactId>
      <version>1.0</version>
      </dependency>
      </dependencies>
      </project>

            • Line in Ant build.xml file that causes the error: ****

      <artifact:pom id="maven.project" file="pom.xml"/>

            • Error that occurs when this line is executed in ant: ****

      Error downloading parent pom: Missing:
      ----------
      1) mygroup:CommonPOM:pom:1.0.2
      Path to dependency:
      1) unspecified:unspecified:jar:0.0
      2) mygroup:CommonPOM:pom:1.0.2

      ----------
      1 required artifact is missing.

      for artifact:
      unspecified:unspecified:jar:0.0

      from the specified remote repositories:
      central (http://repo1.maven.org/maven2)

      1. CASE.tar.gz
        875 kB
        Pino Silvaggio

        Activity

        Hide
        Paul Gier added a comment -

        Pino, can you attach the sources/patch for your fix?

        Show
        Paul Gier added a comment - Pino, can you attach the sources/patch for your fix?
        Hide
        Paul Gier added a comment -

        I spent some time looking into this issue, and it appears that the problem is caused by a disconnect between the repositories defined in the ant tasks

        <pom id="test">
          <remoteRepository url="http://myhouse.com"/>
        </pom>
        

        And the repositories defined using the normal maven way through profiles in the settings or in the pom, etc.

        Repositories from the settings.xml or pom.xml are picked up normally by the MavenProjectBuilder when the pom project is build. Unfortunately the MavenProjectBuilder doesn't have a simple way to pass extra repositories when building the project. So I believe that's why we currently have the extra step of trying to resolve the parent pom (using the ant defined repositories) before we build the whole pom project.

        Unfortunately that extra resolution step for the parent pom only uses the repositories defined in the ant tag. So you get warnings if the parent pom is located in a repository that's defined in settings.xml or pom.xml.

        I believe the correct solution to this is to dynamically create an active profile that contains all the repositories defined in the ant tag, and then add that profile to the profile manager to be used by the MavenProjectBuilder. This way all the repositories (defined in maven or in ant) will be available when the pom project is built.

        This has been changed (and hopefully fixed) in r771425

        Show
        Paul Gier added a comment - I spent some time looking into this issue, and it appears that the problem is caused by a disconnect between the repositories defined in the ant tasks <pom id= "test" > <remoteRepository url= "http://myhouse.com" /> </pom> And the repositories defined using the normal maven way through profiles in the settings or in the pom, etc. Repositories from the settings.xml or pom.xml are picked up normally by the MavenProjectBuilder when the pom project is build. Unfortunately the MavenProjectBuilder doesn't have a simple way to pass extra repositories when building the project. So I believe that's why we currently have the extra step of trying to resolve the parent pom (using the ant defined repositories) before we build the whole pom project. Unfortunately that extra resolution step for the parent pom only uses the repositories defined in the ant tag. So you get warnings if the parent pom is located in a repository that's defined in settings.xml or pom.xml. I believe the correct solution to this is to dynamically create an active profile that contains all the repositories defined in the ant tag, and then add that profile to the profile manager to be used by the MavenProjectBuilder. This way all the repositories (defined in maven or in ant) will be available when the pom project is built. This has been changed (and hopefully fixed) in r771425
        Hide
        Paul Gier added a comment -

        I believe this issue is resolve now. If similar problems still occur please create a new issue or reopen this one.

        Show
        Paul Gier added a comment - I believe this issue is resolve now. If similar problems still occur please create a new issue or reopen this one.
        Hide
        Benson Margulies added a comment -

        I still get this problem with 2.0.10.

        UILD FAILED
        /Users/benson/x/trunk/rlp/utilities/source/java/maven-artifact.xml:16: Unable to initialize POM pom.xml: Cannot find parent: com.basistech:common-parent for project: com.basistech:utilities:jar:7.0-SNAPSHOT for project com.basistech:utilities:jar:7.0-SNAPSHOT

        I have to install tasks in a row: one for the parent, and one for the 'utilities' artifact that uses it. I get the error above.

        I can't reopen because I'm not the original author.

        Show
        Benson Margulies added a comment - I still get this problem with 2.0.10. UILD FAILED /Users/benson/x/trunk/rlp/utilities/source/java/maven-artifact.xml:16: Unable to initialize POM pom.xml: Cannot find parent: com.basistech:common-parent for project: com.basistech:utilities:jar:7.0-SNAPSHOT for project com.basistech:utilities:jar:7.0-SNAPSHOT I have to install tasks in a row: one for the parent, and one for the 'utilities' artifact that uses it. I get the error above. I can't reopen because I'm not the original author.
        Hide
        Paul Gier added a comment -

        Benson, can you open a new issue and attach a sample project that reproduces the problem? This issue covers several related problems, so I would prefer a new Jira issue vs. reopening this one.

        Show
        Paul Gier added a comment - Benson, can you open a new issue and attach a sample project that reproduces the problem? This issue covers several related problems, so I would prefer a new Jira issue vs. reopening this one.

          People

          • Assignee:
            Paul Gier
            Reporter:
            Jeff Campbell
          • Votes:
            5 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: