artifact of packaging 'tar.gz' / dependency of type 'tar.gz downloaded, but not 
saved to local repository
---------------------------------------------------------------------------------------------------------

                 Key: MNG-3078
                 URL: http://jira.codehaus.org/browse/MNG-3078
             Project: Maven 2
          Issue Type: Bug
          Components: Artifacts and Repositories, Dependencies
    Affects Versions: 2.0.7, 2.0.6
            Reporter: Peter Lynch
            Priority: Critical


Using mvn deploy:deploy-file you can successfully upload a 'tar.gz' artifact to 
a repository.

Example without classifier:

mvn deploy:deploy-file -DgroupId=org.apache.tomcat -DartifactId=apache-tomcat 
-Dversion=6.0.13 -Dpackaging=tar.gz -DrepositoryId=repo-central 
-Durl=dav:http://repo.example.com:4000/maven-repos/repo-central/ 
-Dfile=apache-tomcat-6.0.13.tar.gz

Example with classifier
mvn deploy:deploy-file -DgroupId=org.apache.tomcat -DartifactId=apache-tomcat 
-Dversion=6.0.13 -Dpackaging=tar.gz -Dclassifier=bin 
-DrepositoryId=repo-central 
-Durl=dav:http://repo.example.com:4000/maven-repos/repo-central/ 
-Dfile=apache-tomcat-6.0.13.tar.gz

Once uploaded define a dependency in your pom to it.

Example without classifier

<project>
<packaging>pom</packaging>
...
<dependencies>
  ...
  <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>apache-tomcat</artifactId>
      <version>6.0.13</version>
      <type>tar.gz</type>
      <optional>true</optional>
    </dependency>
  ...
</dependencies>
...
</project>

Example with classifier

<project>
<packaging>pom</packaging>
...
<dependencies>
  ...
  <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>apache-tomcat</artifactId>
      <version>6.0.13</version>
      <type>tar.gz</type>
      <classifier>bin</classifier>
      <optional>true</optional>
    </dependency>
  ...
</dependencies>
...
</project>


Now to reproduce the problem you could either do

mvn dependency:resolve

or 

mvn assembly:assembly
(if the maven assembly plugin is configured with a dependency set that unpacks 
this dependency for example)

----

The reason I think this is a core bug and not an maven assembly plugin or 
maven-dependency-plugin bug is because the problem happens in both of these 
independent plugins.

When you run 'mvn dependency:resolve'  you'll see that the dependency appears 
downloaded but then the build fails with :

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.apache.tomcat:apache-tomcat:tar.gz:bin:6.0.13

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.apache.tomcat 
-DartifactId=apache-tomcat \
          -Dversion=6.0.13 -Dclassifier=bin -Dpackaging=tar.gz 
-Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:   
    mvn deploy:deploy-file -DgroupId=org.apache.tomcat 
-DartifactId=apache-tomcat \
          -Dversion=6.0.13 -Dclassifier=bin -Dpackaging=tar.gz 
-Dfile=/path/to/file \
           -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
        1) com.example:core:pom:1.0.0-A1-SNAPSHOT
        2) org.apache.tomcat:apache-tomcat:tar.gz:bin:6.0.13

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

... and even stranger here is the log which proves the dependency was found in 
the repo and downloaded, but NOT saved to local repository.

...
[DEBUG] Trying repository repo-central
Downloading: 
http://repo.example.com:4000/maven-repos/repo-central/org/apache/tomcat/apache-tomcat/6.0.13/apache-tomcat-6.0.13-bin.tar.gz
5826K downloaded
[DEBUG] Unable to get resource 
'org.apache.tomcat:apache-tomcat:tar.gz:bin:6.0.13' from repository 
repo-central (http://engweb.uc.inphonic.com:4000/maven-repos/repo-central)
[DEBUG] Unable to download the artifact from any repository




..and YOU MAY GET FOOLED into thinking all is well. mvn deploy:deploy-file also 
installs the same artifact into your local repo. So if you follow above steps 
and don't get an error it is because the deploy-file goal installed it in your 
local repo. However when someone else tries to use your project they will get 
above error.

So, first delete from your local repo. example:

rm -rf ~/.m2/repository/org/apache/tomcat/apache-tomcat

and then try to execute mvn dependency:resolve and it should fail as described.


...and finally I'll mention that doing the same thing with a 'zip' 
type/packaging there is NO PROBLEM.

Ultimately when using the maven assembly plugin I should be able to specify any 
type of dependency type supported by the maven assembly archiver.




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to