I'm having a problem with Maven Ant Tasks 2.0.9 not properly resolving dependencies with SNAPSHOT versions. If I use version numbers like "1.0-SNAPSHOT" it's fine, the problem is only if my version numbers are just "SNAPSHOT". I'd like to know if this type of versioning is not considered to be best practice and should not work, if my configuration is wrong, or if this is a bug.
I have two projects, testA and testB, both SNAPSHOT versions. testB depends on testA. I can deploy testB, and then if I try to compile testA on another computer (or clean out my local repository), I can see that it downloads the correct version of testA, but in the classpath is uses the full timestamp version number as the directory to look in, whereas in the local repository it was just downloaded to a 'SNAPSHOT' directory, so the build fails because the jar it is looking for doesn't exist. I.e., the classpath produced by <artifact:dependencies> is 'test/example/testA/20080624.210158-2/testA-20080624.210158-2.jar', but the real path to the file is 'test/example/testA/SNAPSHOT/testA-20080624.210158-2.jar' Thanks, David I include my poms and buildfiles, as well as output from deploying and compiling, here: POM for testA: --------------------- <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>test.example</groupId> <artifactId>testA</artifactId> <packaging>jar</packaging> <version>SNAPSHOT</version> <name>testA</name> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project> POM for testB: --------------------- <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>test.example</groupId> <artifactId>testB</artifactId> <packaging>jar</packaging> <version>SNAPSHOT</version> <name>testB</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>test.example</groupId> <artifactId>testA</artifactId> <version>SNAPSHOT</version> <scope>compile</scope> </dependency> </dependencies> </project> Ant script used for both projects: ----------------------------------------------- <project name="example" default="compile" xmlns:artifact="urn:maven-artifact-ant"> <property name="repo.url" value="file:///R:/REMOTE_REPO/"></property> <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.0.9.jar" /> <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" /> <target name="-init" > <artifact:remoteRepository id="remote.repository" url="${repo.url}"> <releases enabled="true" checksumPolicy="warn"/> <snapshots enabled="true" updatePolicy="always" checksumPolicy="warn"/> </artifact:remoteRepository> <artifact:pom id="maven.project" file="pom.xml" /> </target> <target name="clean"> <delete dir="target" /> </target> <target name="compile" depends="clean, -init" description="compile"> <mkdir dir="target"/> <mkdir dir="target/classes"/> <artifact:dependencies pomrefid="maven.project" pathid="build.classpath" usescope="compile"> <remoterepository refid="remote.repository"/> </artifact:dependencies> <javac destdir="target/classes" classpathref="build.classpath" srcdir="src/main/java" /> </target> <target name="package" depends="compile" description="pacakge"> <jar destfile="target/${maven.project.artifactId}.jar" basedir="target/classes"/> </target> <target name="install" depends="package" description="install"> <artifact:install pomrefid="maven.project" file="target/${maven.project.artifactId}.jar" /> </target> <target name="deploy" depends="install" description="deploy"> <artifact:deploy pomrefid="maven.project" file="target/${maven.project.artifactId}.jar" uniqueversion="true"> <remoterepository refid="remote.repository" /> </artifact:deploy> </target> </project> Output of deploying testA: ------------------------------------- deploy: [artifact:deploy] Deploying to file:///R:/REMOTE_REPO/ [artifact:deploy] [INFO] Retrieving previous build number from remote.repository [artifact:deploy] Uploading: test/example/testA/SNAPSHOT/testA-20080624.212701-3.jar to remote.repository [artifact:deploy] Uploaded 2K [artifact:deploy] [INFO] Retrieving previous metadata from remote.repository [artifact:deploy] [INFO] Uploading repository metadata for: 'artifact test.example:testA' [artifact:deploy] [INFO] Retrieving previous metadata from remote.repository [artifact:deploy] [INFO] Uploading repository metadata for: 'snapshot test.example:testA:SNAPSHOT' [artifact:deploy] [INFO] Uploading project information for testA 20080624.212701-3 Output of compiling testB: ------------------------------------- compile: [mkdir] Created dir: C:\Documents and Settings\snyderda\workspace-person\testB\target [mkdir] Created dir: C:\Documents and Settings\snyderda\workspace-person\testB\target\classes [artifact:dependencies] [INFO] snapshot test.example:testA:SNAPSHOT: checking for updates from remote.repository [artifact:dependencies] [INFO] snapshot test.example:testA:SNAPSHOT: checking for updates from suny [artifact:dependencies] Downloading: test/example/testA/SNAPSHOT/testA-20080624.212701-3.pom from remote.repository [artifact:dependencies] Transferring 1K from remote.repository [artifact:dependencies] Downloading: test/example/testA/SNAPSHOT/testA-20080624.212701-3.jar from remote.repository [artifact:dependencies] Transferring 2K from remote.repository [echo] compiling with classpath: C:\sandbox\LOCAL_REPO\test\example\testA\20080624.212701-3\testA-20080624.212701-3.jar [javac] Compiling 1 source file to C:\Documents and Settings\snyderda\workspace-person\testB\target\classes ... followed by compile errors since classes from testA aren't visible --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
