What if I have already jars in my project lib folder and I want to use that folder as my repository instead of downloading and install it into my iv2/local folder.
Right now its first downloading jars from maven to my local repository. Some jars are not found in the repository, but I have them in a lib folder and would lie to retrieve them from there.
You need to create an ivysettings.xml where you define two resolvers in a chain:
FileSystemResolver
Maven Repository Resolver
This could look like this (Example from the chain resolver:
<ivysettings>
<resolvers>
<chain name="test">
<filesystem name="1">
<ivy pattern="${ivy.settings.dir}/lib/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact pattern="${ivy.settings.dir}/lib/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
</filesystem>
<ibiblio name="maven2" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
${ivy.settings.dir} is the folder, where your ivysettings.xml is located.
To include / set an ivysettings.xml in your build.xml you need to use the settings task:
<ivy:settings />
or
<ivy:settings file="path_to_file/ivysettings.xml" />
Related
I have an ivy xml file contains dependencies declarations, but uses the rev="latest.release" settings rather than specifying a hard wired revision.
<dependency org="<organisation name>" name="<module>" rev="latest.release"/>
The reason I am using latest.release is that every Sunday our build process runs and generates 'release' artifacts for ALL modules in our project. These artifacts are named WKXX-YYYY so for example, the most recent was WK05-2017
The problem is, when I do a resolve IVY is resolving the artifacts to version WK50-2016 and I do not understand why. The published ivy.xml that resides with the artifact on our central ivy repo seems correct and the info section states the correct status eg release and the publication date is also correct.
eg
WK50-2016
<info organisation="<org name>" module="<module name>" revision="WK50-2016" status="release" publication="20161218140515"/>
WK05-2017
<info organisation="<org name>" module="<module name>" revision="WK05-2017" status="release" publication="20170205140555"/>
As you can see from the above, the publication date is more recent in the WK05-2017 artifact.
I have also included the ivysettings.xml that is also used as part of the IVY configuration.
ivysettings.xml
<ivysettings>
<settings defaultResolver="chained"/>
<resolvers>
<!-- Remote IVY Repo -->
<filesystem name="remote" changingPattern=".*-SNAPSHOT.*" changingMatcher="regexp" checkmodified="true">
<ivy pattern="${ivy.repo.dir}/[organisation]/[module]/[revision]/ivy.xml"/>
<artifact pattern="${ivy.repo.dir}/[organisation]/[module]/[revision]/[artifact].[ext]"/>
</filesystem>
<!-- Local IVY Repo -->
<filesystem name="local" changingPattern=".*-SNAPSHOT.*" changingMatcher="regexp" checkmodified="true">
<ivy pattern="${ivy.local.repo.dir}/[organisation]/[module]/[revision]/ivy.xml"/>
<artifact pattern="${ivy.local.repo.dir}/[organisation]/[module]/[revision]/[artifact].[ext]"/>
</filesystem>
<!-- Use both the local and remote repos -->
<chain name="chained" changingPattern=".*-SNAPSHOT.*" changingMatcher="regexp" checkmodified="true">
<resolver ref="local" />
<resolver ref="remote"/>
</chain>
</resolvers>
<caches defaultCacheDir="${ivy.cache.dir}" ivyPattern="${ivy.cache.ivy.pattern}" artifactPattern="${ivy.cache.artifact.pattern}"/>
</ivysettings>
Just for reference.
changingPattern=".*-SNAPSHOT.*" changingMatcher="regexp" checkmodified="true"
are used as we also use SNAPSHOT integration artefacts that are built and published when commits are made to trunk. I found that without these attributes ivy would use the local SNAPSHOT even if the version on the remote repo was more recent.
Thanks in advance.
I need to get the Scala.js library as a dependecy in a Ivy-using Eclipse project. Sbt manages to find the dependencies with no problems, but I can't seem to make it work with Ivy.
The jar is available here: http://dl.bintray.com/content/scala-js/scala-js-releases/org.scala-lang.modules.scalajs/scalajs-library_2.10/0.4.2/jars/ I've tried to construct a suitable Url resolver but with no success so far.
Supposedly the dependency in ivy.xml should work like this:
<dependency org="org.scala-lang.modules.scalajs" name="scalajs-library_2.10" rev="0.4.2" />
What do I need in ivysettings.xml to make Ivy pull down the jar for me?
Try this:
<ivysettings>
<settings defaultResolver="central"/>
<resolvers>
<ibiblio name="central" m2compatible="true"/>
<url name="scala">
<artifact pattern="http://dl.bintray.com/content/scala-js/scala-js-releases/[organisation]/[artifact]/[revision]/jars/[artifact].[ext]"/>
</url>
</resolvers>
<modules>
<module organisation="org.scala-lang.*" resolver="scala"/>
</modules>
</ivysettings>
This settings file is designed to retrieve from Maven central by default.
Having a small issue with ivy, artifactory and the spring repo. I was attempting to use:
<dependency org="org.springframework.ldap" name="spring-ldap-core" rev="1.3.2.RELEASE" conf="compile->default"/>
<dependency org="org.springframework.ldap" name="spring-ldap" rev="1.3.2.RELEASE" conf="compile->default"/>
with ivy settings:
<resolvers>
<filesystem name="local">
<ivy pattern="${repository.dir}/[module]/ivy.xml" />
<artifact pattern="${repository.dir}/[module]/[artifact].[ext]" />
</filesystem>
<chain name="chain">
<resolver ref="local"/>
<ibiblio name="artifactory-spring" m2compatible="true" root="http://artifactory.xxx.com:8081/artifactory/spring-release"/>
<ibiblio name="artifactory" m2compatible="true" root="http://artifactory.xxx.com:8081/artifactory/repo1"/>
</chain>
</resolvers>
However, I'm getting errors (ant publish -verbose mode)
[ivy:cachepath] CLIENT ERROR: Not Found url=http://artifactory.xxx.com:8081/artifactory/spring-release/spring-ldap/jars/spring-ldap-1.3.2.RELEASE.jar
[ivy:cachepath] artifactory-spring: no ivy file nor artifact found for org.springframework.ldap#spring-ldap;1.3.2.RELEASE
[ivy:cachepath] tried http://artifactory.xxx.com:8081/artifactory/repo1/org/springframework/ldap/spring-ldap/1.3.2.RELEASE/spring-ldap-1.3.2.RELEASE.pom
[ivy:cachepath] CLIENT ERROR: Not Found url=http://artifactory.xxx.com:8081/artifactory/repo1/org/springframework/ldap/spring-ldap/1.3.2.RELEASE/spring-ldap-1.3.2.RELEASE.pom
[ivy:cachepath] tried http://artifactory.xxx.com:8081/artifactory/repo1/org/springframework/ldap/spring-ldap/1.3.2.RELEASE/spring-ldap-1.3.2.RELEASE.jar
[ivy:cachepath] CLIENT ERROR: Not Found url=http://artifactory.xxx.com:8081/artifactory/repo1/org/springframework/ldap/spring-ldap/1.3.2.RELEASE/spring-ldap-1.3.2.RELEASE.jar
indicating that repo1 doesn't have version 1.3.2 and the spring maven repo doesn't have the pom or anything. How do I get ivy (or maybe artifactory?) to deal with the spring maven repo properly? I'm guessing the spring repo is simply not m2compatible, though I've tried flagging the ibiblio setting to false for this.
Thanks!
You have configured your settings file to download from the non-existent "xxx.com" domain.
Good news is that you don't need a settings file at all, by default ivy will download from the Maven Central repository.
Bad news is that there is no 1.3.2.RELEASE version of the spring-ldap artifact:
spring-ldap versons
spring-ldap-code versions
The following ivy file works:
<dependency org="org.springframework.ldap" name="spring-ldap-core" rev="1.3.2.RELEASE" conf="compile->default"/>
<dependency org="org.springframework.ldap" name="spring-ldap" rev="1.3.1.RELEASE" conf="compile->default"/>
In my project I have two separate source folders - /src where the code is and /test for mock and test objects.
On top of the standard jar (from /src) that ivy successfully publishes for my project I would like to publish another artifact through ivy that only includes the objects in the /test folder in order to be able to share these mock objects with other projects.
Can someone please provide an ivy configuration to support this?
1- You need to build a test-jar from the test-folder, lets call it project-test.jar
<javac destdir="build/test" srcdir="test/">
<classpath refid="test.classpath" />
</javac>
<jar destfile="dist/project-test.jar"
basedir="build/test"/>
2- Define an artifact in your ivy.xml
<publications>
<artifact name="project" type="jar" conf="default" ext="jar"/>
<artifact name="project-test" type="jar" conf="test ext="jar"/>
</publications>
3- Publish
<ivy:resolve
revision="${project.version}"
conf="compile,test"
/>
<!-- Alle Artifacts für compile mit dem jars resolver publishen -->
<ivy:publish
revision="${project.version}">
<artifacts pattern="dist/[artifact]-[revision].[type]" />
</ivy:publish>
I have an ivy.xml that can successfully resolve all of its dependencies, except the following one.
<dependency org="org.springframework" name="spring-test" rev="3.0.2.RELEASE" force="true" conf="compile->test"/>
My ivysettings.xml has the following resolver:
<ibiblio name="maven" m2compatible="true" root="http://repo2.maven.org/maven2/" />
When I attempt to resolve dependencies, I receive the following error message:
Server access Error: Connection refused: connect url=http://repo2.maven.org/maven2/org/springframework/spring-test/3.0.2.RELEASE/spring-test-3.0.2.RELEASE.pom
However, when I navigate to that URL in my browser, I've can see the .pom and the .jars. What could be preventing Ivy from resolving this dependency?
Certainly sounds like a proxy issue.
Any chance the other spring dependencies were previously downloaded (for example when you were working at home) and were retrieved from the ivy cache?
To configure ANT to use the same proxy as your web browser you need to read this web page. In summary, set the following environment variables with the appropriate values:
export ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
I had the same issue with 3.0.5 but I don't use a proxy. The fix for me was to add the spring repo for releases as I only had external in my ivysettings.xml.
ivysettings.xml
<ivysettings>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="springsource-external" m2compatible="true" root="http://repository.springsource.com/maven/bundles/external"/>
<ibiblio name="springsource-release" m2compatible="true" root="http://repository.springsource.com/maven/bundles/release"/>
</chain>
</resolvers>
</ivysettings>