【问题标题】:Issue while publishing the artifacts (Ivy publishes multiple jars with different name but with same content)发布工件时出现问题(Ivy 发布多个名称不同但内容相同的 jar)
【发布时间】:2011-04-20 05:55:11
【问题描述】:

我有一个奇怪的问题,在我的发布任务中,可以将一个 ivy.xml 中存在的多个工件发布到存储库中,但这些工件的内容是相同的。简而言之,ivy 在 ivy.xml 的发布标签中发布多个名称不同的工件,但每个工件的内容相同。以下是我所做的历史:

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>  

构建.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> 

该应用创建的我的罐子
ppm-${ppmversion}.jar
xbeancomponent-${ppmversion}.jar
在 ${srcRoot}/tmp/jars 中

在解析器中,我使用的是 google 提供的 svnkit
..
..
..

 <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>

..
..
..

问题:
1. 上述设置的问题是,当我运行 publishPPM 任务时,它会将我的 ppm-ivy.xml 更改为我不想要的实际版本。如果它将该文件写入svn(它没有这样做)但不在我在svn中提交的源代码中,它就可以了。 所以我尝试从 ivy:publish 任务中删除 forcedeliver="true" (我真的不知道这个任务是做什么的)属性,这有帮助,但我得到了预期的 verison internal@.. 而不是 1.2.0 我在 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}" status="release" overwrite="true"> 
                        <artifacts pattern="${srcRoot}/tmp/jars/[module].[ext]" /> 
                </ivy:publish> 
 </target> 

我为解决这个问题所做的是在 ppm-ivy.xml 的 info 标签中我添加了修订属性,所以我的 ppm-ivy.xml 如下所示:

<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>  

现在它将两个文件都发布到存储库中,但问题是 xbeancomponent.jar 是 ppm.jar 的精确副本,只是名称不同。你能帮我么?

【问题讨论】:

    标签: ivy


    【解决方案1】:

    我认为主要问题是您用于查找要发布的工件的模式:

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

    您没有包含工件名称,而仅包含模块名称。您的模块名称是“ppm”,因此每个 jar 工件都将根据此模式标识为 ppm.jar。你可能想改用这个:

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

    至于其他方面,关于svn和版本,恐怕我不明白这个问题。如果您仍然需要帮助,请澄清。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-23
      • 2016-02-29
      • 1970-01-01
      • 2018-07-06
      • 2011-02-15
      • 2021-07-19
      • 1970-01-01
      • 2014-05-06
      相关资源
      最近更新 更多