Having a problem with Ivy + Maven Snapshots + rev="latest.revision". Ivy is properly parsing the metadata to discover the latest version of the artifact, but it seems to decline downloading it. I'm stuck with an earlier version of the artifact. Does the text below give anyone any ideas why it's doing it?
[ivy:resolve] listing revisions from maven-metadata: http://my-maven/content/repositories/snapshots/ca/spacek/api-project/maven-metadata.xml
[ivy:resolve] my-snapshots: found md file for ca.spacek#api-project;latest.integration
[ivy:resolve] => http://my-maven/content/repositories/snapshots/ca/spacek/api-project/0.0.3-SNAPSHOT/api-project-0.0.3-20121211.132856-8.pom (0.0.3-SNAPSHOT)
[ivy:resolve] my-snapshots: revision already resolved: ca.spacek#api-project;0.0.3-SNAPSHOT
I looked at this and tried setting the pattern the same, but it didn't seem to help. I'm hoping to avoid workarounds like this.
Downloading snapshots works for me. I've supplied a working example below. Possible to supply more details?
I've seen issues with Maven snapshots in the past but that was because the repository metadata files were not being updated as expected, resulting in the wrong artifact being downloaded.
Another possible issue is a invalid cache. Perhaps you could try and purge it (See the "clean-all" target in the example below).
Example
[ivy:resolve] :: Apache Ivy 2.3.0-rc1 - 20120416000235 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: file = /?????/ivysettings.xml
[ivy:resolve] :: resolving dependencies :: myOrg#Demo;????
[ivy:resolve] confs: [default]
[ivy:resolve] found commons-lang#commons-lang;2.7-SNAPSHOT in apache-snapshots
[ivy:resolve] downloading https://repository.apache.org/content/groups/snapshots/commons-lang/commons-lang/2.7-SNAPSHOT/commons-lang-2.7-20120610.132226-5.jar ...
build.xml
<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="build.dir" location="build"/>
<target name="resolve" description="Use ivy to resolve classpaths">
<ivy:resolve/>
</target>
<target name="clean" description="Cleanup build files">
<delete dir="${build.dir}"/>
</target>
<target name="clean-all" depends="clean" description="Additionally purge ivy cache">
<ivy:cleancache/>
</target>
</project>
ivy.xml
<ivy-module version="2.0">
<info organisation="myOrg" module="Demo"/>
<dependencies>
<dependency org="commons-lang" name="commons-lang" rev="2.7-SNAPSHOT"/>
</dependencies>
</ivy-module>
ivysettings.xml
<ivysettings>
<settings defaultResolver="repos" />
<resolvers>
<chain name="repos">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="apache-snapshots" m2compatible="true" root="https://repository.apache.org/content/groups/snapshots"/>
</chain>
</resolvers>
</ivysettings>
Related
I am trying to use the ivy:publish task to publish my jars using the public ibiblio resolver which I understand corresponds to the Maven central repository.
It seems to sort of work, but I am eventually getting an HTTP 405: Method Not Allowed.
The relevant sections from my ivysettings.xml, ivy.xml and build.xml files are:
ivysettings.xml
This is actually the entire file:
<ivysettings>
<settings defaultResolver="public"/>
<resolvers>
<ibiblio name="public" m2compatible="true" />
</resolvers>
</ivysettings>
ivy.xml
...
<publications>
<artifact type="pom" ext="pom" conf="default"/>
<artifact type="jar" ext="jar" conf="default"/>
</publications>
...
build.xml
...
<target name="gen-pom" depends="ivy-resolve">
<ivy:makepom ivyfile="ivy.xml" pomfile="${dist.dir}/${ant.project.name}.pom">
<mapping conf="default" scope="compile"/>
</ivy:makepom>
</target>
<target name="ivy-publish" depends="jar, gen-pom" description="publish jar/source to maven repo">
<ivy:publish resolver="public" forcedeliver="true" overwrite="true" publishivy="false">
<artifacts pattern="${dist.dir}/[artifact].[ext]" />
</ivy:publish>
</target>
...
When I invoke ant ivy-publish I get:
impossible to publish artifacts for mant-tasks#mant-tasks;1.0: java.io.IOException: PUT operation to URL https://repo1.maven.org/maven2/mant-tasks/mant-tasks/1.0/mant-tasks-1.0.pom failed with status code 405: Method Not Allowed
I guess this makes sense otherwise anybody would be able to pollute the namespace. So my questions are:
is this due to my lack of credentials? I.e. would I need to add a
credentials element in my ivysettings.xml as shown in this
answer?
can I obtain credentials for ibiblio for my
insignificant module and if not what other freely available public
repositories are available to a Java developer who doesn't want to
build and maintain their own maven repository? I need to be able to pull-in my module (as an IVY dependency of other projects) from a globally available repository.
Maven central is operated by Sonatype, the creators of Maven:
http://central.sonatype.org/
JFrog operate a competing service called bintray:
https://bintray.com/
I suggest reading the documentation and obtain a credential that will allow to publish your module's file(s)
Info:
java version: 1.8.0_66
ant version: 1.9.6
What I want to do:
Provide a code coverage report for the server's code that is running on AWS windows 2k12 server.
What I did:
Stop the server completely.
Put jacocoagent.jar into server's bin folder. Note: this is inside Program Files folder
Append -javaagent settings to JAVA_OPTS that is used during server start up.
Start the server.
Run my sample test from my local laptop.
Stop the server completely. This produced a 184kb jacoco.exec.
Copied my build.xml to the same directory where the jacoco.exec is located. C:/path/to/exec/jacoco.exec
Copied jacocoant.jar to C:/path/to/jacocoant.jar
cd into C:/path/to/exec/ and run command "ant"
Result:
Got error unable to read execution data file C:/path/to/exec/jacoco.exec
Build.xml:
<project name="Example" default="rebuild" xmlns:jacoco="antlib:org.jacoco.ant">
<description>
Example Ant build file that demonstrates how a JaCoCo coverage report
can be itegrated into an existing build in three simple steps.
</description>
<property name="result.dir" location="." />
<property name="result.classes.dir" location="${result.dir}/path/to/classes" />
<property name="result.report.dir" location="${result.dir}/report" />
<property name="result.exec.file" location="${result.dir}/jacoco.exec" />
<!-- Step 1: Import JaCoCo Ant tasks -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="../jacocoant.jar" />
</taskdef>
<target name="clean">
<delete dir="${result.report.dir}" />
</target>
<target name="report">
<!-- Step 3: Create coverage report -->
<jacoco:report>
<!-- This task needs the collected execution data and ... -->
<executiondata>
<file file="${result.exec.file}" />
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="JaCoCo Code Coverage Report">
<classfiles>
<fileset dir="${result.classes.dir}" >
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}" />
</sourcefiles>
</structure>
<!-- to produce reports in different formats. -->
<html destdir="${result.report.dir}" />
<csv destfile="${result.report.dir}/report.csv" />
<xml destfile="${result.report.dir}/report.xml" />
</jacoco:report>
</target>
I am not sure if the problem is with exec file (it is corrupted maybe) or is with my entire setup.
Any help to identify and help solving the problem is appreciated!!!
Thanks!
I got this when using gradle and jaCoCo.
I deleted the build/ directory and reran ./gradlew jacocoTestReport, this time passing.
Similar to #sofia's solution but for gradle:
I removed the version after tool version. Instead of
allprojects {
jacoco {
toolVersion = '0.7.1.201405082137'
}
}
I used the following
allprojects {
jacoco {
toolVersion = '0.7.1'
}
}
I have the same problem recently, it took me long time to figure this out. I hope how I fix this will help you or someone else.
Use ant -verbose report to see the detailed information. I used "ant -verbose report" and got this message: "java.io.IOException: Incompatible version 1007".
As I am using maven, I added the following lines to my pom.xml. Note: version is the same as your javaagent's version.
<dependency> <groupId>org.jacoco</groupId> <artifactId>org.jacoco.ant</artifactId> <version>0.7.4.201502262128</version> </dependency>
In the end, the report is successfully generated.
I am working with Apache Ivy to manage transitive dependencies.
Working with Maven was quite a good experience because if there was any dependency that was not available at a remote directory or available with a different version, then Maven would manage those effectively.
However, Ivy gets stuck with this in my case as I am trying to manage Mule dependencies but it is being difficult for Ivy to manage while Maven manages it well without any problems.
One more important point is that I cannot even exclude any dependency because I don't want to exclude but I want Ivy to be capable enough so that it can manage it all or any other way if any.
Below is a screenshot of the error along with the necessary XML files.
ivy.xml
<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="MyOrganization"
module="TestForIvySupport"
status="integration">
</info>
<dependencies>
<dependency org="org.mule" name="mule-core" rev="3.6.0"/>
</dependencies>
ivysettings.xml
<settings defaultResolver="chained"/>
<resolvers>
<chain name="chained">
<url name="custom-repo">
<ivy pattern="https://repository.mulesoft.org/nexus/content/groups/public/org/[organisation]/[module]/[revision]/ivy-[revision].xml"/>
<artifact pattern="https://repository.mulesoft.org/nexus/content/groups/public/org/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
</url>
<ibiblio name="ibiblio" m2compatible="true" root="http://mirrors.ibiblio.org/maven2/"/>
<ibiblio name="ibiblio1" m2compatible="true" root="http://repo1.maven.org/maven2/"/>
</chain>
</resolvers>
build.xml
<project name="test ivy" default="test" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="test" description="Test ivy installation">
<ivy:settings file="ivysettings.xml"/>
<ivy:retrieve sync="false" pattern="myfolder/[artifact]-[revision].[ext]"/>
</target>
Using your example I had a different error:
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: UNRESOLVED DEPENDENCIES ::
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: org.mule.mvel#mule-mvel2;2.1.9-MULE-005: not found
[ivy:resolve] :: org.mule.common#mule-common;3.6.0: not found
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
I eventually got it working but discovered a broken POM.
Working Example
ivy.xml
<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="MyOrganization"
module="TestForIvySupport"
status="integration">
</info>
<dependencies>
<!-- Exclude the broken dependency -->
<dependency org="org.mule" name="mule-core" rev="3.6.0" conf="default">
<exclude org="com.github.stephenc.eaio-grabbag" module="grabbag"/>
</dependency>
<!-- Just pull down the jar artifact associated with the module -->
<dependency org="com.github.stephenc.eaio-grabbag" name="grabbag" rev="1.8.1" conf="default">
<artifact name="grabbag" type="jar"/>
</dependency>
</dependencies>
</ivy-module>
Notes:
The POM associated with the grabbag dependency is broken.
Work-around tells ivy to ignore the POM and then we explicitly pull down the jar file as a second dependency declaration.
ivysettings.xml
<ivysettings>
<settings defaultResolver="chained"/>
<resolvers>
<chain name="chained" returnFirst="true">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="mulesoft" m2compatible="true" root="https://repository.mulesoft.org/nexus/content/groups/public"/>
</chain>
</resolvers>
</ivysettings>
Notes:
Simplified the settings file to use ibiblio resources to talk to just two Maven repositories: Maven Central and the Mulesoft repository
Error analysis
Analysis of first error
I tracked this down to a problem with the parent pom of the "mule-core" module.
http://search.maven.org/#artifactdetails|org.mule|mule|3.6.0|pom
There is an override dependency where the property refers to a version of "mule-mvel2" module that doesn't exist in Maven Central
<properties>
..
<muleMvelVersion>2.1.9-MULE-005</muleMvelVersion>
..
</properties>
<dependency>
<groupId>org.mule.mvel</groupId>
<artifactId>mule-mvel2</artifactId>
<version>${muleMvelVersion}</version>
</dependency>
Managed to fix this by adding the following Mulesoft repository.
https://repository.mulesoft.org/nexus
Analysis of second error
Trouble shooting this further I discovered a second cascaded error:
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: FAILED DOWNLOADS ::
[ivy:resolve] :: ^ see resolution messages for details ^ ::
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: com.github.stephenc.eaio-grabbag#grabbag;1.8.1!grabbag.non-maven-jar
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
This problem is more serious as it's caused by a misconfigured POM file:
http://search.maven.org/#artifactdetails|com.github.stephenc.eaio-grabbag|grabbag|1.8.1|pom
Where the packaging has been changed from the "jar" default
<packaging>non-maven-jar</packaging>
The ivy work-around for is to exclude this broken transitive dependency and then explicitly pull down the jar artifact as a second dependency in the ivy file.
I have raised a github issue with the the project.
I have some problems understanding how the publication works. I have to publish a jar file to my web repository, but I have found some probably maybe by the fact that I missing something about the artifact and the publication.
These are my three files for the publication:
Build.xml
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="pubblication"
default="pubblication" basedir=".">
<echo>inizio</echo>
<target name="pubblication" description="--> pubblicare un artifact">
<ivy:settings file="archivaIvySetting.xml" />
<ivy:publish resolver="publish-artifact" conf="publicConf" organisation="bbi"
module="resutil" revision="1.0">
<artifacts pattern="./[artifact]-[revision].[type]"/>
</ivy:publish>
</target>
</project>
Ivy.xml
<ivy-module version="2.0">
<info organisation="org.apache" module="central"/>
<configurations>
<conf name="publicConf" visibility="public" />
</configurations>
<publications>
<artifact name="[organisation]-resutil" ext="jar" conf="publicConf"/>
</publications>
</ivy-module>
archivaIvySetting.xml
<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
<property name="archiva-internal" value="http://host.com:8080/repository
/internal/"/>
<settings defaultResolver="central">
<credentials host="host.com" realm="Repository Archiva Managed internal
Repository" username="username" passwd="passwd" />
</settings>
<resolvers >
<ibiblio name="central" m2compatible="true" usepoms="true" root="${archiva-
internal}" />
</resolvers>
</ivysettings>
My problem is that when I do the build that ant says there is no module with that name in the cache. Now the question:
1) In the pattern do I set the jar that I want to publish?
2) If not how do I must to do practically that: take the jar give it the info params and publish it in the repo?
I repeat the file already exist, and this is a test file.
The pattern in the publish task should match a that is created locally in your build. Additionally the publish section of the ivy file must match the files your attempting to upload.
Hopefully some examples will help:
good ivy tutorial for local repository?
Issues using ivy:publish task
Convert ivy.xml to pom.xml
how to publish 3rdparty artifacts with ivy and nexus
I want to use the Ivy Eclipse plugin to reolve the spring-oxm dependency.
<dependency org="org.springframework" name="spring-oxm" rev="3.2.2.RELEASE" />
But I got below error:
Some projects fail to be resolved Impossible to resolve dependencies
of my class name unresolved dependency:
org.restlet.jee#org.restlet;2.1.1: not found unresolved dependency:
org.restlet.jee#org.restlet.ext.servlet;2.1.1: not found
I googled, and people say the restlet-2.1.1 no longer exist. And I have no idea how to solve this problem.
Its available in this repo http://maven.restlet.org/org/restlet/jee/org.restlet/2.1.1/
Probably you need to add this repository in your Ivy settings or any repository you are using.
Well, i just now had same problem with my Solr 5.5.0 with changing repository for IVY. But that's all waste of time.
Just download org.restlet.ext.servlet jar file from http://maven.restlet.com/org/restlet/jee/org.restlet.ext.servlet/2.1.1/, create folder repository near ivy-settings.xml, copy downloaded file and change ivy-settings.xml like :
<ivysettings>
<settings defaultResolver="chain-example"/>
<resolvers>
<chain name="chain-example">
<ibiblio name="central" m2compatible="true" />
<filesystem name="libraries">
<artifact pattern="${ivy.settings.dir}/repository/[artifact]-[revision].[ext]" />
</filesystem>
</chain>
</resolvers>
</ivysettings>
Enjoy.