jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2.x Ant Tasks
  • MANTTASKS-25

~/.m2/settings.xml ignored when using M2 ant task 'install-provider'

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Windows XP SP2.

Description

From the local M2 repository I deleted the jar file junit 3.8.1
including the corresponding POM and hash files. However these files are
also present in our corporate repository (currently used for simulation
purposes):

http://localhost:8080/maven-proxy-webapp/repository

We also have a file ~/.m2/settings.xml:

<settings>

<mirrors>
<mirror>
<mirrorOf>central</mirrorOf>
<id>central_mirror</id>
<url>http://localhost:8080/maven-proxy-webapp/repository</url>
</mirror>
</mirrors>

<profiles>
<profile>
<id>DEV</id>
<repositories>
<repository>
<id>central</id>
<url>http://localhost:8080/maven-proxy-webapp/repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<url>http://localhost:8080/maven-proxy-webapp/repository</url>
</pluginRepository>
</pluginRepositories>
<properties>
<repository.id>repo_dev</repository.id>
<repository.url>scp://localhost/m2demo/repo_dev</repository.url>
</properties>
</profile>
</profiles>

<activeProfiles>
<activeProfile>DEV</activeProfile>
</activeProfiles>

<settings>

This allows to always pass through the corporate repository to retrieve
artifacts/plugins (instead of the default repository
http://www.ibiblio.org/maven2).

Remark that this corporate repository is running locally , so normally
it is NOT needed to have Internet access. **Therefore the local machine
isn't connected to the Internet.**

We have the following ANT script build.xml that uses M2 ant tasks 2.0.4:

build.xml:

<project name="test" default="test"
xmlns:m="antlib:org.apache.maven.artifact.ant">

<target name="test">

<m:install-provider artifactId="wagon-ssh"
version="1.0-alpha-5"/>

</target>

</project>

In the same folder as build.xml we also have a file pom.xml:

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.project</groupId>
<artifactId>project-model</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>

</dependencies>

<distributionManagement>
<repository>
<id>repo_dev</id>
<url>scp://localhost/m2demo/repo_dev</url>
</repository>
</distributionManagement>

</project>

When executing the target 'test' from the above ANT script, we get the
following error message:

test:
[m:install-provider] An error has occurred while processing the Maven artifact tasks.
[m:install-provider] Diagnosis:
[m:install-provider]
[m:install-provider] Error downloading wagon provider from the remote
repository: Unable to get dependency information: Unable to read the
metadata file for artifact 'junit:junit:jar': Error getting P OM for
'junit:junit' from the repository: Error transferring file
[m:install-provider] junit:junit:pom:3.8.1
[m:install-provider]
[m:install-provider] from the specified remote repositories:
[m:install-provider] central (http://repo1.maven.org/maven2)
[m:install-provider]
[m:install-provider] junit:junit:jar:3.8.1
[m:install-provider]
[m:install-provider] from the specified remote repositories:
[m:install-provider] central (http://repo1.maven.org/maven2)
[m:install-provider] Path to dependency:
[m:install-provider] 1) unspecified:unspecified:jar:0.0
[m:install-provider] 2) org.apache.maven.wagon:wagon-ssh:jar:1.0-alpha-5
[m:install-provider] 3) org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8
[m:install-provider]
[m:install-provider]
[m:install-provider]

BUILD FAILED
C:\tmp\build.xml:8: Error downloading wagon provider from the remote
repository: Unable to get dependency information: Unable to read the
metadata file for artifact 'junit:junit:jar': Error getting PO M for
'junit:junit' from the repository: Error transferring file
junit:junit:pom:3.8.1

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

junit:junit:jar:3.8.1

from the specified remote repositories:
central (http://repo1.maven.org/maven2)
Path to dependency:
1) unspecified:unspecified:jar:0.0
2) org.apache.maven.wagon:wagon-ssh:jar:1.0-alpha-5
3) org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8

So it seems install-provider just ignores the central repository
settings defined in ~/.m2/settings.xml and uses the settings defined in
wagon-ssh-1.0-alpha-5.pom .

Remark : we also tested with the following variants of the above ANT
script build.xml:

<project name="test" default="test"
xmlns:m="antlib:org.apache.maven.artifact.ant">

<target name="test">

<m:pom id="POM" file="pom.xml"/>

<m:install-provider artifactId="wagon-ssh"
version="1.0-alpha-5"/>

<!-- OR
<m:install-provider artifactId="wagon-ssh"
version="1.0-alpha-5" pomRefId="POM"/>
-->

</target>

</project>

but unfortunately the same error occurred.

However, the following ANT script solves the above problem :

<project name="test" default="test"
xmlns:m="antlib:org.apache.maven.artifact.ant">

<target name="test">

<m:pom id="POM" file="pom.xml"/>

<!-- will retrieve junit from our corporate repository (using
settings from ~/.m2/settings.xml) -->
<m:dependencies pomRefId="POM"/>

<!-- junit already in local repository, so won't give any errors any
more -->
<m:install-provider artifactId="wagon-ssh"
version="1.0-alpha-5"/>

</target>

</project>

but this is because the task m:dependencies correctly uses the file
~/.m2/settings.xml to retrieve junit from the corporate repository.

Issue Links

is related to

Bug - A problem which impairs or prevents the functions of the product. MANTTASKS-12 No means of preventing ant task from querying repo1.maven.org

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Jason van Zyl added a comment - 28/Mar/07 9:46 AM

This will be fixed when the embedder is used, which we can do when 2.1-alpha-1 is released. It has all the nice settings.xml integation.

Show
Jason van Zyl added a comment - 28/Mar/07 9:46 AM This will be fixed when the embedder is used, which we can do when 2.1-alpha-1 is released. It has all the nice settings.xml integation.
Hide
Permalink
Jason van Zyl added a comment - 26/May/07 11:10 AM

The settings aren't used generally very well as reported by Brian Fox so I'll take that one.

Show
Jason van Zyl added a comment - 26/May/07 11:10 AM The settings aren't used generally very well as reported by Brian Fox so I'll take that one.

People

  • Assignee:
    Unassigned
    Reporter:
    Davy Toch
Vote (0)
Watch (1)

Dates

  • Created:
    11/Jun/06 1:47 PM
    Updated:
    26/May/07 11:10 AM
    Resolved:
    26/May/07 11:10 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.