Classifiers not working in Maven Snapshot repo for IVY

邮差的信 提交于 2019-12-14 03:16:30

问题


So I have got my Maven build deploying both Java5 and Java6 versions to my snapshot repo (Nexus). I do this with build profiles and classifiers. All is good in the Maven side of things.

However, if I try to resolve the Java5 dependency from my IVY based project it will not work if the most recent Maven deploy was for the Java6 profile/classifier. I guess this is because the timestamp in maven-metadata.xml picks out the Java6 version. It does work if the most recent deploy was for Java5.

This is the resolver:

<ibiblio name="snapshot-repo-name"
                 m2compatible="true"
                 root="snapshot-repo-root"
                 pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
                 usepoms="true"
                 checkmodified="true"
                 changingPattern=".*SNAPSHOT"/>

Deploying Java6 of the dependency therefore breaks the build of IVY-built application.


回答1:


The work-around is to mark the Maven snapshot as non-unique versions in the <distributionManagement/> element. That is, there are no longer timestamped versions in the Maven snapshot repository.

<distributionManagement>
    <repository>
        <id>PROJECT-RELEASE</id>
        <name>PROJECT-RELEASE</name>
        <url>http://foo.bar:8081/nexus/content/repositories/PROJECT-RELEASE</url>
    </repository>
    <snapshotRepository>
        <id>PROJECT-SNAPSHOT</id>
        <name>PROJECT-SNAPSHOT</name>
        <uniqueVersion>false</uniqueVersion>
        <url>http://foo.bar:8081/nexus/content/repositories/PROJECT-SNAPSHOT</url>
    </snapshotRepository>
</distributionManagement>



回答2:


Is it the resolution that is failing or the retrieve? (Retrieve does an implicit resolve).

My build once failed because the following pattern wasn't unique (Needed a classifier in the name pattern to cater for source and javadoc artifacts):

<ivy:retrieve pattern="lib/[artifact].[ext]"/>


来源:https://stackoverflow.com/questions/3500478/classifiers-not-working-in-maven-snapshot-repo-for-ivy

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!