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

No explanation of how to use multiple Maven repositories to resolve dependencies

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.1.1
    • Component/s: documentation
    • Labels:
      None
    • Number of attachments :
      0

      Description

      There does not seem to be any documentation on how to use multiple repositories when resolving dependencies.

        Issue Links

          Activity

          Hide
          SebbASF added a comment -

          Also, the existing documentation appears to be misleading when it says:

          If no remote repositories are specified, the default http://repo1.maven.org/maven2/ is used. But if at least one remote repository is specified, repo1 is not automatically added: you have to declare it if you need it.

          As far as I can tell, central is always searched.

          Show
          SebbASF added a comment - Also, the existing documentation appears to be misleading when it says: If no remote repositories are specified, the default http://repo1.maven.org/maven2/ is used. But if at least one remote repository is specified, repo1 is not automatically added: you have to declare it if you need it. As far as I can tell, central is always searched.
          Hide
          Knut Forkalsrud added a comment -

          I have the same experience. Even if I name my repository "central" it will not override the builtin "central", but instead append to it.

          Here's my sample ant task (using maven-ant-tasks 2.1.0)

          <target name="init">

          <artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
          <remoteRepository id="central" url="http://mycompany.net/nexus/content/repo"/>
          <dependency groupId="foo" artifactId="bar" version="3.8.2"/>
          </artifact:dependencies>

          </target>

          A few lines of output from "ant -v compile":

          [artifact:dependencies] Using remote repositories:

          Show
          Knut Forkalsrud added a comment - I have the same experience. Even if I name my repository "central" it will not override the builtin "central", but instead append to it. Here's my sample ant task (using maven-ant-tasks 2.1.0) <target name="init"> <artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset"> <remoteRepository id="central" url="http://mycompany.net/nexus/content/repo"/> <dependency groupId="foo" artifactId="bar" version="3.8.2"/> </artifact:dependencies> </target> A few lines of output from "ant -v compile": [artifact:dependencies] Using remote repositories: id=central, url= http://mycompany.net/nexus/content/repo , releases=enabled, snapshots=enabled id=central, url= http://repo1.maven.org/maven2 , releases=enabled, snapshots=disabled org.apache.maven:super-pom:jar:2.0 (selected)
          Hide
          Knut Forkalsrud added a comment -

          I did some debugging here, and it turns out the "central" repository comes from the pom,
          or more specifically pom.getRepositories() near line 187 of DependenciesTask.java.
          There is no <repository> element declared in pom.xml, so it must come from some implicit
          parent pom.

          Show
          Knut Forkalsrud added a comment - I did some debugging here, and it turns out the "central" repository comes from the pom, or more specifically pom.getRepositories() near line 187 of DependenciesTask.java. There is no <repository> element declared in pom.xml, so it must come from some implicit parent pom.
          Hide
          Herve Boutemy added a comment -

          There does not seem to be any documentation on how to use multiple repositories when resolving dependencies.

          reference documentation tells "The task can include the dependency nested type, in addition to the other shared types localRepository, pom and remoteRepository": how can I make it more explicit?

          As far as I can tell, central is always searched.

          True with Maven Ant Tasks 2.1.0: previous versions had a bug in parent pom handling which dropped repository definition. But now that it is fixed, central is always searched as it is defined in super-pom.
          I'll fix the documentation

          Even if I name my repository "central" it will not override the builtin "central", but instead append to it.

          nice catch.
          Please create another jira issue, since this is a bug

          Show
          Herve Boutemy added a comment - There does not seem to be any documentation on how to use multiple repositories when resolving dependencies. reference documentation tells "The task can include the dependency nested type, in addition to the other shared types localRepository, pom and remoteRepository": how can I make it more explicit? As far as I can tell, central is always searched. True with Maven Ant Tasks 2.1.0: previous versions had a bug in parent pom handling which dropped repository definition. But now that it is fixed, central is always searched as it is defined in super-pom . I'll fix the documentation Even if I name my repository "central" it will not override the builtin "central", but instead append to it. nice catch. Please create another jira issue, since this is a bug
          Hide
          Herve Boutemy added a comment -

          documentation about central repository fixed in r965247

          for multiple remote repositories usage, it's already written just a few lines before:

          All of the tasks can optionally take one or more remote repositories to download from and upload to, and a local repository to store downloaded and installed archives to.

          Show
          Herve Boutemy added a comment - documentation about central repository fixed in r965247 for multiple remote repositories usage, it's already written just a few lines before: All of the tasks can optionally take one or more remote repositories to download from and upload to, and a local repository to store downloaded and installed archives to.
          Hide
          Knut Forkalsrud added a comment -

          I filed MANTTASKS-195 for the override problem.

          Show
          Knut Forkalsrud added a comment - I filed MANTTASKS-195 for the override problem.
          Hide
          SebbASF added a comment -

          The page

          http://maven.apache.org/ant-tasks/reference.html#remoteRepository

          says:

          "Specifies the location of the remote repository."

          This could be taken to mean that there is only one remote repo. Would be better as:

          "Specifies the location of a remote repository."

          Show
          SebbASF added a comment - The page http://maven.apache.org/ant-tasks/reference.html#remoteRepository says: "Specifies the location of the remote repository." This could be taken to mean that there is only one remote repo. Would be better as: "Specifies the location of a remote repository."
          Hide
          Herve Boutemy added a comment -

          nice catch: done in r966786

          Show
          Herve Boutemy added a comment - nice catch: done in r966786

            People

            • Assignee:
              Herve Boutemy
              Reporter:
              SebbASF
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: