0
votes

I have a weird issue where in my publish task works perfectly fine of publishing multiple artifacts present within one ivy.xml onto repository but the content of those artifact are the same. In short ivy publishes multiple artifact with different name as in publish tag of ivy.xml but with same content in each of them. Following are the history of what i did:

ppm-ivy.xml

<ivy-module version="2.0">  
 <info organisation="ppm" module="ppm"/> 
 <configurations>  
  <conf name="internal" description="found within JP repositories" /> 
 </configurations>  

 <publications>       
  <artifact name="ppm" type="jar" ext="jar"/>       
  <artifact name="xbeancomponent" type="jar" ext="jar"/> 
 </publications>  
 <dependencies> 
  <dependency org="junit" name="junit" rev="latest.integration" conf="internal-> *"/> 
  <dependency org="qpid" name="qpid-client" rev="${qpidVersion}" conf="internal-> *"/> 
  <dependency org="guice" name="guice" rev="${guiceVersion}" conf="internal-> *"/> 
 </dependencies>   
</ivy-module>  

build.xml

<target name="publishPPM" description="publish merlin service to shared repo with ivy"> 
                <ivy:resolve settingsRef="2" file="ppm-ivy.xml" revision="${ppmVersion}" type="jar" /> 
                <ivy:publish settingsRef="2" resolver="publish" srcivypattern="ppm-ivy.xml" organisation="ppm" module="ppm" revision="${ppmVersion}" pubrevision="${ppmVersion}" forcedeliver="true" status="release" overwrite="true"> 
                        <artifacts pattern="${srcRoot}/tmp/jars/[module].[ext]" /> 
                </ivy:publish> 
 </target> 

My jars that app created
ppm-${ppmversion}.jar
xbeancomponent-${ppmversion}.jar
are in ${srcRoot}/tmp/jars

In resolver i am using svnkit provided by google
..
..
..

 <typedef name="svn" classname="fm.last.ivy.plugins.svnresolver.SvnResolver"/>  

 <resolvers> 
 <svn name="publish" repositoryRoot="http://subversion.myrepo.com/svn/repos/sharedRepo/trunk/ivyRepository" userName="myuser" userPassword="mypass" binaryDiff="false"> 
         <artifact pattern="[organisation]/jars/[revision]/[artifact]-[revision].[ext]"/> 
       </svn>

..
..
..

Problems:
1. Problem with above set up is that when i run publishPPM task, it changes my ppm-ivy.xml with the actual versions which i dont want. Its ok if it writes that file to svn (which its not doing) but not in my source code which is committed in the svn. so i tried removing the forcedeliver="true" (i really dont know what this task does) attribute from ivy:publish task which helped but i got expected verison internal@.. instead of 1.2.0 My new task in build.xml is

<target name="publishPPM" description="publish merlin service to shared repo with ivy"> 
                <ivy:resolve settingsRef="2" file="ppm-ivy.xml" revision="${ppmVersion}" type="jar" /> 
                <ivy:publish settingsRef="2" resolver="publish" srcivypattern="ppm-ivy.xml" organisation="ppm" module="ppm" revision="${ppmVersion}" pubrevision="${ppmVersion}" status="release" overwrite="true"> 
                        <artifacts pattern="${srcRoot}/tmp/jars/[module].[ext]" /> 
                </ivy:publish> 
 </target> 

What i did to resolve this issue was in the info tag in ppm-ivy.xml i added revision attribute so my ppm-ivy.xml looks as below:

<ivy-module version="2.0">  
 <info organisation="ppm" module="ppm" revision="${ppmVersion}"/> 
 <configurations>  
  <conf name="internal" description="found within JP repositories" /> 
 </configurations>  

 <publications>       
  <artifact name="ppm" type="jar" ext="jar"/>       
  <artifact name="xbeancomponent" type="jar" ext="jar"/> 
 </publications>  
 <dependencies> 
  <dependency org="junit" name="junit" rev="latest.integration" conf="internal-> *"/> 
  <dependency org="qpid" name="qpid-client" rev="${qpidVersion}" conf="internal-> *"/> 
  <dependency org="guice" name="guice" rev="${guiceVersion}" conf="internal-> *"/> 
 </dependencies>   
</ivy-module>  

Now its publishing both the files into repository but the issue is xbeancomponent.jar is exact replica of ppm.jar just the name are different. Can you please help me?

1

1 Answers

1
votes

I think the main problem is the pattern you use for finding artifacts to publish:

<artifacts pattern="${srcRoot}/tmp/jars/[module].[ext]" />

You didn't include the artifact name, but only the module name. Your module name is "ppm", so every jar artifact will be identified as ppm.jar based on this pattern. You probably want to use this instead:

<artifacts pattern="${srcRoot}/tmp/jars/[artifact].[ext]" />

As for the other things, about svn and versions, I'm afraid I don't understand the problem. If you still need help, then please clarify.