ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tamer Erdogan <Tamer.Erdo...@vasco.com>
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:

<dependencies>
         <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"
/>
         </dependency>
<dependencies>

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:
dist/lib/hello-world/windows-64
dist/lib/hello-world/linux-64

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>PackagingManager.java (<b>Aug 21, 2015 5:25:44 PM</b>)</html>
+++ <html>PackagingManager.java (<b>Aug 21, 2015 5:32:57 PM</b>)</html>
@@ -21,7 +21,6 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-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 [mailto:jai.forums2013@gmail.com] 
Sent: Friday, August 21, 2015 22:59
To: ivy-user@ant.apache.org
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="http://ant.apache.org/ivy/extra">
     <info organisation="org.myapp" module="foo-bar" 
revision="0.1.0-SNAPSHOT"/>

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

....

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


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!hello-world.zip(zip)
...

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

-Jaikiran


Mime
View raw message