Hi Hervé,

I've created a set of files that show the problem. I hope I didn't
miss any details below. :-)

My settings.xml (~/.m2/settings.xml) has the following:

<settings
  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/xsd/settings-1.0.0.xsd";
>
  <profiles><profile>
    <activation><activeByDefault>true</activeByDefault></activation>
    <repositories><repository>
      <id>MyRepo</id>
      <url>file:///home/hwijbenga/maven-test/repository</url>
      <layout>default</layout>
    </repository></repositories>
  </profile></profiles>
</settings>

Furthermore, my "project" is as follows:

my_project/lib/maven-ant-tasks-2.0.7.jar
my_project/build.xml
my_project/pom.xml
repository/
my_parent_pom/pom.xml

The following sequence of commands shows the problems (I haven't
listed the output).

in my_parent_pom:
mvn deploy

rm ~/.m2/repository/com/example
(To make sure your local repository if empty.)

in my_project:
ant
(This will fail.)

mvn package
(This will download the parent POM and succeed.)

ant
(This will now succeed.)

The parent POM contains:

<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/xsd/maven-4.0.0.xsd";
>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>pom</artifactId>
  <packaging>pom</packaging>
  <version>1.0</version>
  <name>Parent POM</name>
  <distributionManagement>
    <repository>
      <id>myRepo</id>
      <url>file:///home/hwijbenga/maven-test/repository</url>
    </repository>
  </distributionManagement>
</project>

The project POM:

<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/xsd/maven-4.0.0.xsd";
>
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.example</groupId>
    <artifactId>pom</artifactId>
    <version>1.0</version>
  </parent>
  <groupId>com.example</groupId>
  <artifactId>my_project</artifactId>
  <packaging>jar</packaging>
  <version>0.1-SNAPSHOT</version>
  <name>My Project</name>
</project>

And, finally, the build.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:artifact="urn:maven-artifact-ant" default="build">
  <target name="build">
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
       uri="urn:maven-artifact-ant"
    >
      <classpath>
        <pathelement location="lib/maven-ant-tasks-2.0.7.jar"/>
      </classpath>
    </typedef>
    <artifact:pom id="maven.project" file="pom.xml"/>
    <artifact:dependencies verbose="true"
      filesetId="maven-ant-tasks.dependency.fileset"
    >
      <pom refid="maven.project"/>
      <artifact:remoteRepository id="remote"
        url="file:///home/hwijbenga/maven-test/repository"
      />
    </artifact:dependencies>
  </target>
</project>

Cheers,
Hilco

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to