Certain developers on my project are unable to successfully execute an ivy resolve. We use an ivy ssh resolver to a remote server/file system. Impacted developers are typically resolving all but 1 or 2 dependencies successfully. The dependencies that fail to be resolved are the larger jars (example: nasa worldwind). Again, most users are able to resolve all dependencies with no problem. The eclipse project, ivy.xml and ivysettings.xml all come from the software repo and are identical between impacted and unimpacted users. If I copy the failed dependency from my ivy2 cache into an impacted users ivy2 cache, the problem goes away. The ivy resolve is initiated through eclipse/ivyDE.
Things I believe are eliminated:
differences in ivy.xml, ivysetings.xml, and eclipse project
existance of dependency on server
file permission issues on remote file system
network connectivity
version differences in eclipse/ivyDE
Question: What could be causing ivy resolves to fail for some users? I am starting to suspect this may be a timeout issue with ivy, given that it happens with larger jars.
Configuration:
Eclispe Kepler
IvyDE 2.2.0
example ivysettings.xml:
<ivysettings>
<settings defaultResolver="test-chain" />
<resolvers>
<chain name="test-chain">
<ssh name="test-cm" host="IPaddress">
<ivy pattern="/cm/lib/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact pattern="/cm/lib/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
</ssh>
<url name="test-cm-file">
<ivy pattern="file://cm/lib/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact pattern="file://cm/lib/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
</url>
</chain>
</resolvers>
</ivysettings>
example ivy.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info
organisation="test"
module="Application"
status="integration">
</info>
<dependencies>
<dependency org="nasa" name="worldwind" rev="1.4.0"/>
</dependencies>
</ivy-module>
Using Eyad Ebrahim's suggestions, I was able to examine the IvyDE console and gain insight into the problem. The issue turned out to be that several developers did not have an ivysettings.xml set in either the eclipse global or project IvyDE properties. IvyDE was attempting to use an internet resolver by default, which resulted in two subsequent issues including no public repo for products like worldwind, and blocking of certain files by my company network infrastructure. After correctly configuring the ivysettings.xml file, the custom file/url resolvers listed above were used and everything worked.
Thanks!
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 have an Artifactory server that I use to resolve Ivy dependencies. When I want to add a dependency to my ivy.xml, I sometimes have to add an explicit nested <artifact> tag, and I don't understand why.
Example A:
<dependency org="com.google" name="guava" rev="[7,)" conf="compile,runtime" />
Example B
<dependency org="com.twelvemonkeys.common" name="common-image" rev="3.0.1" conf="compile,runtime">
<artifact name="common-image" ext="jar"/>
</dependency>
Looking at the cached dependencies in the Artifactory tree view, there's nothing that indicates that the last example should need extra info to resolve the dependency, but Artifactory suggests it itself, and the resolution doesn't work without out.
I'm using Ivy against a repository with Maven layout. My settings where generated by Artifactory and look something like:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-settings>
<settings defaultResolver="main" />
<resolvers>
<chain name="main">
<ibiblio
name="public"
m2compatible="true"
root="http://example.org/artifactory/remote-repos" />
</chain>
</resolvers>
</ivy-settings>
Why does Artifactory require an explicit artifact for some Ivy dependencies and not for others?
Edit 20151005: Added Ivy settings example
The tool performing the dependency resolution is the Ivy client and not Artifactory.
Based on the dependency deceleration the Ivy resolver decides which artifact to request from the repository (in your case it is Artifactory).
The artifact feature provides more control on a dependency for which you do not control its ivy file.
It enables to specify the artifacts required, if the dependency has no ivy file.
For more information about the artifact feature and when it should be used consult the Ivy documentation.
Uinsg IntelliJ, currently ivy gives me this error message:
:: downloading artifacts ::
[NOT REQUIRED] folder#scopt;2.10-3.1.0!scopt.jar
When I try to use our firm-internal ivy system.
I can see that the jar file is in the correct location that the resolver points to, and the ivy cache (using IntelliJ) is clean.
Ivy otherwise will download files requested.
The issue is with IntelliJ, eclipse can find and download the jar with the same ivy.xml and ivy.settings file without any issue
This is not a duplicate as suggested - if i change my internal IntelliJ settings to exclude jar files then i get an error at the bottom of the output (stating that jar files are not to be downloaded). I currently have the logging as "All" in intelliJ)
~~~~~
The ivy resolver code is:
<resolvers>
<filesystem name="secret-source-resolver" checkmodified="true" checkconsistency="false">
<artifact pattern="//a/b/c/d/[organisation]/e/f/[module]/[artifact]_[revision].[ext]" />
</filesystem>
</resolvers>
<modules>
<module organisation="theOrg" name="scopt" resolver="secret-source-resolver" />
</modules>
And the ivy.xml file is
<dependencies>
<dependency org="theOrg" name="scopt" rev="2.10-3.1.0">
<artifact name="scopt" type="jar" force="true" conf="runtime" />
</dependency>
</dependencies>
Looking at the folder that i'm getting the files from, the jar files are present.
Finally, in the output:
don't use cache for theOrg#scopt;2.10-3.1.0: checkModified=true
trying //v/campus/ny/cs/theOrg/shared/apps/scopt/scopt_2.10-3.1.0.jar
tried //v/campus/ny/cs/theOrg/shared/apps/scopt/scopt_2.10-3.1.0.jar
secret-source-resolver: no ivy file found for theOrg#scopt;2.10-3.1.0: using default data
checking theOrg#scopt;2.10-3.1.0[default] from secret-source-resolver against [none]
module revision kept as first found: theOrg#scopt;2.10-3.1.0[default] from secret-source-resolver
found theOrg#scopt;2.10-3.1.0 in secret-source-resolver
would indicate that ivy can find it, it just felt that downloading would be... bad?
I am currently using intelliJ 12.0 (company thing, v. hard to upgrade)
Any ideas?
No solution unfortunately, but we are seeing the same thing. It does not appear to be consistent however, it works as expected on some developers machines but fails with this error on others.
How to publish multiple jar files having different version number in Nexus Sonatype Repository using ivy and ant.
How Can Write ivy.xml file ??
Suppose I have following two jar files
addressing-1.0.jar and
castor-1.3.jar
How Should I provide version number in ivy.xml as there are two different version number here(1.0 and 1.3) to publish these jar files in Nexus Sonatype Repository with appropriate
version numbers.
Thanking You
Looking for reply to this question.
please
All the files published by a build would be associated with the same release revision.
I suspect that what you need to do is upload dependencies? In which case the simplest way is to use the Nexus GUI or the following answer
Upload artifacts to Nexus, without Maven
Explanation
The ivy file describes both the project dependencies and the files generated and published by the project.
So for example the following files lists the two files which ivy will upload into Nexus, a jar and a POM file:
<ivy-module version='2.0'>
<info organisation="com.myspotonontheweb" module="donaldduck"/>
<publications>
<artifact name="donaldduck" type="jar"/>
<artifact name="donaldduck" type="pom"/>
</publications>
<dependencies>
..
..
<dependencies/>
</ivy-module>
The point is... All files published by this module would have the same version number.
And this is specified by the publish task (See pubrevision attribute):
<ivy:publish resolver="nexus" pubrevision="${publish.revision}" overwrite="true" publishivy="false" >
<artifacts pattern="${build.dir}/[artifact].[ext]"/>
</ivy:publish>
Observation
The files in your example are looks like files available from Maven Central. This means they're automatically proxied by your Nexus server, and can be included in your project as dependencies:
<dependencies>
<dependency org="net.sourceforge.addressing" name="addressing" rev="1.1.1"/>
<dependency org="org.codehaus.castor" name="castor" rev="1.2"/>
<dependencies/>
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>