maven - Artifactory: Deploying Snapshots with Ant -


i deploying artifacts ant build artifactory using these targets:

<project name="myapp" default="main" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant"> . . . <path id="maven-ant-tasks.classpath">     <fileset refid="maven-ant-tasks.fileset" /> </path> <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />  <target name="define-artifact-properties">     <property name="artifact.group" value="my.org" />     <property name="artifact.name" value="myapp" />     <property name="artifact.version" value="1.9.0-devel.snapshot" />     <property name="artifact.type" value="jar" />     <property name="artifact.dir" value="${build.dir}/artifacts" />     <property name="artifact.pom" value="${artifact.dir}/${artifact.name}-${artifact.version}.pom" /> </target>  <target name="copy-artifacts" depends="init, define-artifact-properties">     <copy file="${server.jar}" tofile="${artifact.dir}/${artifact.name}-${artifact.version}-server.jar" overwrite="true" preservelastmodified="true" />     <copy file="${dist.ear.dir}/${application.name}.depl" tofile="${artifact.dir}/${artifact.name}-${artifact.version}.depl" overwrite="true" preservelastmodified="true" />     <copy file="${server.ear}" tofile="${artifact.dir}/${artifact.name}-${artifact.version}.ear" overwrite="true" preservelastmodified="true" />     <copy file="${client.jar}" tofile="${artifact.dir}/${artifact.name}-${artifact.version}-client.jar" overwrite="true" preservelastmodified="true" />     <copy file="${server.interfaces.jar}" tofile="${artifact.dir}/${artifact.name}-${artifact.version}-interfaces.jar" overwrite="true" preservelastmodified="true" />     <copy file="${prozess.jar}" tofile="${artifact.dir}/${artifact.name}-${artifact.version}-prozess.jar" overwrite="true" preservelastmodified="true" />     <copy file="${src.zip}" tofile="${artifact.dir}/${artifact.name}-${artifact.version}-sources.jar" overwrite="true" preservelastmodified="true" /> </target>  <!-- deploy-task creating , writing temporary pom-file , deploying artifact beside pom-file --> <target name="release-artifacts" depends="init, define-artifact-properties, copy-artifacts">     <fail message="property 'artifactory.publish.url' muss fuer das releasen ins artifactory gesetzt sein!" unless="artifactory.publish.url" />     <fail message="property 'artifactory.publish.username' muss fuer das releasen ins artifactory gesetzt sein!" unless="artifactory.publish.username" />     <fail message="property 'artifactory.publish.password' muss fuer das releasen ins artifactory gesetzt sein!" unless="artifactory.publish.password" />      <mkdir dir="${artifact.dir}" />      <artifact:pom id="tmp.pom" groupid="${artifact.group}" artifactid="${artifact.name}" version="${artifact.version}" packaging="${artifact.type}" name="${artifact.name}" />     <artifact:writepom pomrefid="tmp.pom" file="${artifact.pom}" />     <artifact:deploy file="${artifact.dir}/${artifact.name}-${artifact.version}-server.jar">         <remoterepository url="${artifactory.publish.url}">             <authentication username="${artifactory.publish.username}" password="${artifactory.publish.password}" />         </remoterepository>         <attach file="${artifact.dir}/${artifact.name}-${artifact.version}.depl" type="depl" />         <attach file="${artifact.dir}/${artifact.name}-${artifact.version}.ear" type="ear" />         <attach file="${artifact.dir}/${artifact.name}-${artifact.version}-client.jar" classifier="client" type="jar" />         <attach file="${artifact.dir}/${artifact.name}-${artifact.version}-interfaces.jar" classifier="interfaces.jar" type="jar" />         <attach file="${artifact.dir}/${artifact.name}-${artifact.version}-prozess.jar" classifier="prozess.jar" type="jar" />         <attach file="${artifact.dir}/${artifact.name}-${artifact.version}-sources.jar" classifier="sources" type="jar" />         <pom file="${artifact.pom}" />     </artifact:deploy> </target> 

this works fine normal version. can find artifacts on artifactory expected. versions "1.9.0-devel-snapshot" work fine.

but if use version contains ".snapshot" (for example "1.9.0-devel.snapshot") artifactory adds timestamp. might not big deal, reason artifactory fills snapshots , old snapshots not getting deleted. maven snapshot version behavior on artifactory set nonunique should prevent timestamps, not!

it strange, how artifacts end in repository when using ".snapshot"-version, because version folder correct, artifactnames wrong: enter image description here

here repository configuration:

enter image description here

the topic have found far 1 (artifactory snapshot filename handling), ist not directly apply problem, because don't want timestamps.

i using artifactory 3.8.0

any , explanations appreciated

you can set maven snapshot version behavior deployer - use format sent deployer is.
in addition, can set value of max unique snapshots in order clean older snapshots. value of 0 (default) indicates there no limit on number of unique snapshots.

update

the unique snapshot version (timestamp) created ant maven plugin , not artifactory. prevent ant maven plugin generating unique snapshot version, need set value of uniqueversion property false (default true):

<artifact:deploy file="..." uniqueversion="false"> 

in addition, if artifactory identify deployed version snapshot, need use new custom layout treat ".snapshot" snapshot identifier.
fastest way copying maven layout , using \.snapshot integration revision patterns.
after creating new layout need create local repository use layout.

if not need artifactory treat version snapshot, can configure repository accept deployments of both snapshots , releases.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -