ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tamer Erdogan <>
Subject RE: dependency packaging unpack problem
Date Mon, 24 Aug 2015 08:27:51 GMT
Thanks, I tried it again and it unpacked the artifact successfully. However it would be nicer
to put packaging attribute without extra namespace. Because it can be added without extra
namespace in the publications artifacts.

But now I have another problem. In dependency artifacts I have two artifacts with classifiers
as follow:

         <dependency org="org.myapp" name="hello-world" 
rev="0.2.0-SNAPSHOT" conf="internal->default">
             <artifact name="hello-world" ext="zip" e:packaging="zip" e:classifier="windows-64"
             <artifact name="hello-world" ext="zip" e:packaging="zip" e:classifier="linux-64"

After running the retrieve command:
java -jar $IVY_HOME/ivy-2.4.0.jar -settings "./ivysettings.xml" -ivy 
"./ivy.xml" -retrieve "./dist/lib/[artifact]/[classifier].[ext]" -m2compatible
In the output folder I have two unpackaged folders as follows:

But the problem is that the two folders have the same content. That means ivy extracts only
one of them. And it is randomly. Then I looked at the Ivy source code and I think the problem
is in org.apache.ivy.core.pack.PackagingManager. Here is my diff:

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- <html> (<b>Aug 21, 2015 5:25:44 PM</b>)</html>
+++ <html> (<b>Aug 21, 2015 5:32:57 PM</b>)</html>
@@ -21,7 +21,6 @@
-import java.util.Map;
 import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.descriptor.DefaultArtifact;
 import org.apache.ivy.core.settings.IvySettings;
@@ -64,13 +63,13 @@
 		ext = packing.getUnpackedExtension(ext);
-		for (Map.Entry<Object, Object> entry : artifact.getExtraAttributes().entrySet())
+		String classifier = "";
+		if (artifact.getExtraAttribute("classifier") != null) {
+			classifier = "_" + artifact.getExtraAttribute("classifier");
-		String classifier = artifact.getExtraAttribute("classifier");
 		DefaultArtifact unpacked = new DefaultArtifact(artifact.getModuleRevisionId(),
-				artifact.getPublicationDate(), artifact.getName(),
+				artifact.getPublicationDate(), artifact.getName() + classifier,
 				artifact.getType() + "_unpacked", ext);
 		return unpacked;

Best regards
Tamer Erdogan

-----Original Message-----
From: Jaikiran Pai [] 
Sent: Friday, August 21, 2015 22:59
Subject: Re: dependency packaging unpack problem

I just gave this a try and it worked for me. It could be that in your case the unpacking is
failing for some reason.

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="">
     <info organisation="org.myapp" module="foo-bar" 

         <conf name="internal" visibility="private"/>


         <dependency org="org.myapp" name="hello-world" 
rev="0.2.0-SNAPSHOT" conf="internal->default">
             <artifact name="hello-world" ext="zip" e:packaging="zip" />

Then I run:

java -jar $IVY_HOME/ivy-2.4.0.jar -settings "./ivysettings.xml" -ivy 
"./ivy.xml" -retrieve "./dist/lib/[artifact].[ext]" -sync -m2compatible

I see this log:

Unpacking org.myapp#hello-world;0.2.0-SNAPSHOT!

and I see it extracted in the dist/lib folder. I'm using 2.4.0 of Ivy.


View raw message