Skip to content

Instantly share code, notes, and snippets.

@pentaho-nbaker
Created August 20, 2015 12:29
Show Gist options
  • Save pentaho-nbaker/32de4896e5f39aae951f to your computer and use it in GitHub Desktop.
Save pentaho-nbaker/32de4896e5f39aae951f to your computer and use it in GitHub Desktop.
ivy-settings.xml with Local Maven support
<?xmlversion="1.0"encoding="UTF-8"?>
<ivysettings>
<propertiesenvironment="env"/>
<propertyname="ivy.local.default.root"value="${ivy.default.ivy.user.dir}/local"override="true"/>
<propertyname="ivy.local.default.artifact.pattern"value="[organisation]/[module]/[revision]/[type]s/[artifact]-[revision].[ext]"
override="false"/>
<!-- Repository for Pentaho-hosted artifacts -->
<propertyname="pentaho.resolve.repo"value="http://ivy-nexus.pentaho.org/content/groups/omni"override="false"/>
<!-- Repository for External-hosted artifacts (Optional. Defaults to Pentaho-hosted.) -->
<propertyname="public.resolve.repo"value="${pentaho.resolve.repo}"override="false"/>
<settingsdefaultResolver="pentaho-chained-resolver"/>
<includeurl="${ivy.default.settings.dir}/ivysettings-public.xml"/>
<includeurl="${ivy.default.settings.dir}/ivysettings-local.xml"/>
<resolvers>
<chainname="pentaho-chained-resolver">
<resolverref="local"/>
<dualname="pentaho">
<urlname="pentaho-ivy"checkmodified="true"changingPattern=".*-SNAPSHOT.*">
<ivypattern="${pentaho.resolve.repo}/[organisation]/[module]/[revision]/[module]-[revision].ivy.xml"/>
</url>
<ibiblioname="pentaho-mvn"m2compatible="true"root="${pentaho.resolve.repo}"/>
</dual>
<ibiblioname="local-mvn"m2compatible="true"root="file://${user.home}/.m2/repository"changingPattern=".*-SNAPSHOT.*"/>
<ibiblioname="public-maven"root="${public.resolve.repo}"m2compatible="true"/>
</chain>
</resolvers>
<cacheslockStrategy="artifact-lock"resolutionCacheDir="${ivy.default.ivy.user.dir}/resol-cache${env.EXECUTOR_NUMBER}"/>
</ivysettings>
@stepanovdg
Copy link

ivy.setting includes local filesystem

`

 <filesystem name="local-m2-publish" m2compatible="true">
       <artifact pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
 </filesystem>
<chain name="pentaho-chained-resolver">
  <resolver ref="local" />
  <resolver ref="local-m2"/>
`

and in subfloor.xml new target

<target name="publish-local-maven" depends="init" description="publish jar/source to maven repo mounted at ~/.m2/repository"> <ivy:makepom ivyfile="${ivyfile}" pomfile="${dist.dir}/pom.xml"> <mapping conf="default" scope="compile"/> <mapping conf="runtime" scope="runtime"/> </ivy:makepom> <ivy:publish resolver="local-m2-publish" forcedeliver="true" overwrite="true" publishivy="false"> <artifacts pattern="${dist.dir}/[artifact]-[revision](-[classifier]).[ext]"/> </ivy:publish> </target>

But also we need to disable <snapshots><enabled>false</enabled></snapshots> and <updatePolicy>never</updatePolicy> in .m2/settings.xml (in other case nexus artifacts is preferred than local received from ivy )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment