I'm using json-schema-validator and guava in the same project. When I try to update either one I get a conflict for findbugs, so one lib is left out.
The working versions are:
json-schema-validator 2.0.0
guava 13.0.1
Both rely on findbugs 1.3.9
The version I'd like to use:
json-schema-validator 2.2.1
guava 16.0.1
Here json-schema-validator needs findbugs (jsr305) 2.0.1 and guava needs findbugs 1.3.9. Is there any way around this problem? With that I mean that I can use json-schema-validator version 2.2.1 and guava 16.0.1 in my project.
Sample files:
build.xml
<project name="example" default="download"
xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="download" description="resolve dependencies with ivy">
<ivy:resolve />
<ivy:retrieve sync="true" type="jar"/>
</target>
</project>
ivy.xml, working
<?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="example" module="example" status="integration">
</info>
<dependencies>
<dependency org="com.github.fge" name="json-schema-validator" rev="2.0.0" />
<dependency org="com.google.guava" name="guava" rev="13.0.1" />
</dependencies>
</ivy-module>
ivy.xml, not working
<?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="example" module="example" status="integration">
</info>
<dependencies>
<dependency org="com.github.fge" name="json-schema-validator" rev="2.2.1" />
<dependency org="com.google.guava" name="guava" rev="16.0.1" />
</dependencies>
</ivy-module>
eviction notice:
[ivy:resolve] :: evicted modules:
[ivy:resolve] com.google.code.findbugs#jsr305;1.3.9 by [com.google.code.findbugs#jsr305;2.0.1] in [default]
#Julien thanks for the hint, according to the example there I changed the retrieve line to
<ivy:retrieve pattern="lib/[artifact]-[revision].[ext]" sync="true"/>
and it works now.
Related
I wrote some Nutch plugin with using different extension points such as Protocol, Parser and etc. These plugins work perfectly inside eclipse. But in order to use them on hadoop cluster it should be built by using ANT. My problem is, I wrote some classes in some new packages inside core folder(src). These classes are shared cross different developed plugins. My problem is at build time of developed plugins, ANT can not find the mentioned shared classes, so I am unable to complete the build process successfully. For better understanding of my problem Here is build.xml of one of my plugins:
<project name="filter-news" default="jar-core">
<import file="../build-plugin.xml"/>
<!-- Build compilation dependencies -->
<target name="deps-jar">
<ant target="jar" inheritall="false" dir="../lib-xml"/>
</target>
<!-- Add compilation dependencies to classpath -->
<path id="plugin.deps">
<fileset dir="${nutch.root}/build">
<include name="**/lib-xml/*.jar" />
</fileset>
</path>
<!-- Deploy Unit test dependencies -->
<!-- Deploy Unit test dependencies -->
<!-- for junit test -->
</project>
ivy.xml:
<ivy-module version="1.0">
<info organisation="org.apache.nutch" module="${ant.project.name}">
<license name="Apache 2.0"/>
<ivyauthor name="Apache Nutch Team" url="http://nutch.apache.org"/>
<description>
Apache Nutch
</description>
</info>
<configurations>
<include file="../../..//ivy/ivy-configurations.xml"/>
</configurations>
<publications>
<!--get the artifact from our module name-->
<artifact conf="master"/>
</publications>
<dependencies>
<dependency org="mysql" name="mysql-connector-java" rev="5.1.31"/>
<dependency org="net.sourceforge.htmlcleaner" name="htmlcleaner" rev="2.2"/>
<dependency org="commons-jxpath" name="commons-jxpath" rev="1.3"/>
</dependencies>
</ivy-module>
plugin.xml:
<plugin id="filter-news" name="Apache Nutch XML/HTML Parser/Indexing Filter" version="1.4" provider-name="nutch.org">
<runtime>
<library name="filter-news.jar">
<export name="*"/>
</library>
<library name="ant-1.7.0.jar"/>
<library name="ant-launcher-1.7.0.jar"/>
<library name="jdom-1.1.jar"/>
<library name="commons-jxpath-1.3.jar"/>
<library name="htmlcleaner-2.2.jar"/>
<library name="mysql-connector-java-5.1.31.jar"/>
</runtime>
<requires>
<import plugin="nutch-extensionpoints"/>
</requires>
<extension id="org.apache.nutch.parse" name="Nutch XML/HTML Html parser filter" point="org.apache.nutch.parse.HtmlParseFilter">
<implementation id="com.ictcert.nutch.filter.news.NewsHtmlFilter" class="com.ictcert.nutch.filter.news.NewsHtmlFilter" />
</extension>
<extension id="org.apache.nutch.indexer" name="Nutch XML/HTML Indexing Filter" point="org.apache.nutch.indexer.IndexingFilter">
<implementation id="com.ictcert.nutch.filter.news.NewsIndexingFilter" class="com.ictcert.nutch.filter.news.NewsIndexingFilter"/>
</extension>
</plugin>
When I try to build this plugin ant can not find all of the class dependencies related to com.ictcert.nutch package which is located in core part of nutch (src). While for other classes located in org.apache.nutch I have not such problem. Would you please tell me what is wrong with my configuration that the default packages could be found by ANT but the new ones could not.
As far as I know from my experience the implementation id should have the same package structure as your extension point. Can you try that and see if it solves your problem.
At our company, we are migrating our old ivy repository to Nexus.
After uploading our own artifacts to Nexus, I tried downloading a few projects' dependencies to test the setup, but I'm failing with spring-web. Let me explain how.
Here is the ivy-settings.xml file pointing only to our local Nexus installation
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivysettings>
<settings defaultResolver="default" />
<resolvers>
<ibiblio name="nexus" m2compatible="true" root="http://nexus.local/nexus/content/repositories/central/" />
<ibiblio name="our-nexus" m2compatible="true" root="http://nexus/nexus/content/repositories/repo" />
<chain name="default" returnFirst="true">
<resolver ref="our-nexus" />
<resolver ref="nexus" />
</chain>
</resolvers>
</ivysettings>
In one of our projects we use Spring Web, but not all of its dependencies, so I declared
<dependency org="org.springframework" name="spring-web" rev="3.0.5.RELEASE" transitive="false" />
This worked fine when using Ivy repository. However today I can't perform an <ivy:retrieve> task because it can't find com.caucho#hessian#3.2.1
<ivy:report> task says that such version of hessian is required by spring-web 3.2.11.RELEASE
But I have declared transitive="false"!!!
Why isn't it working? What am I missing/messing?
Should work. Personally I prefer configuration mappings. Try the following instead:
<dependency org="org.springframework" name="spring-web" rev="3.0.5.RELEASE" conf="default->master" />
For more details see:
How can I include the Ivy dependency and none of its dependencies?
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
From my build.xml:
<?xml version="1.0" encoding="utf-8" ?>
<project name="myapp" default="package-core" basedir=".."
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:antcontrib="antlib:net.sf.antcontrib">
<target name="bootstrap">
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="build.path"/>
</target>
<target name="resolve" depends="bootstrap">
<ivy:settings url="${ivy.settings.home}"/>
<ivy:cleancache/>
<ivy:resolve file="build/${ivy.xml}"/>
<ivy:retrieve pattern="${gen.lib.main.dir}/[artifact]-[revision].[ext]" conf="main"/>
<ivy:report todir="${gen.staging.dir}" />
</target>
...omitted for brevity
<target name="publish" depends="compile">
<ivy:publish resolver="default-resolver" pubrevision="0.2.0" overwrite="true" update="true">
<artifacts pattern="${gen.dist.pub.dir}/[artifact].[ext]" />
</ivy:publish>
</target>
My ivy.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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="myapp" module="myapp"/>
<configurations>
<conf name="main" description="provides main dependencies for the client JAR"/>
</configurations>
<dependencies>
<!-- Main dependencies. -->
<dependency org="google" name="guava" rev="14.0" conf="main->*"/>
<dependency org="google" name="guice" rev="3.0" conf="main->*"/>
</dependencies>
</ivy-module>
My ivy-settings.xml:
<ivysettings>
<properties file="ivy-settings.properties"/>
<settings defaultResolver="default-resolver"/>
<latest-strategies>
<latest-lexico/>
</latest-strategies>
<credentials host="${ivy.repo.root}" realm="${ivy.std.repo.realm}"
username="${ivy.std.repo.username}" password="${ivy.std.repo.password}"/>
<resolvers>
<chain name="default-resolver" returnFirst="true">
<url name="std-repo">
<ivy pattern="${ivy.repo.root}/${ivy.module.pattern}"/>
<artifact pattern="${ivy.repo.root}/${ivy.artifact.pattern}"/>
</url>
</chain>
</resolvers>
<modules>
<module organisation="myapp" name="*" resolver="default-resolver"/>
</modules>
</ivysettings>
Question:
When I run the resolve target, I successfully pull down the Guava and Guice JARs (and all their dependencies). So I know I have this set up, at least partially correct.
But when I run the publish target, I get the following error:
[jar] Building jar: /home/myuser/sandbox/dsi/workbench/eclipse/workspace/myapp/gen/dist/myapp-server
publish:
[ivy:publish] :: loading settings :: url = jar:file:/home/myuser/sandbox/dsi/workbench/eclipse/4.2/eclipse/plugins/org.apache.ivy.eclipse.ant_2.3.0.final_20130110142753/ivy.jar!/org/apache/ivy/core/settings/ivysettings.xml
BUILD FAILED
/home/myuser/sandbox/dsi/workbench/eclipse/workspace/myapp/build/build-core.xml:289: no organisation provided for ivy publish task: It can either be set explicitely via the attribute 'organisation' or via 'ivy.organisation' property or a prior call to <resolve/>
Any ideas? Thanks in advance!
You have to call 'publish' and 'resolve' in the same Ant session. If you call them separately it won't work and you'll get this error message.
For instance, you could let the 'publish' target depend on the 'resolve' target:
<target name="publish" depends="resolve,compile">
...
</target>
Hope this helps,
Maarten
Not sure if I'm going about this the right way, but I have some artifacts that I'm trying to convert to maven using ivy ant tasks and push into my maven repo.
the component in question is mystuff.services.common.
First I make the pom...
<ivy:makepom ivyfile="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/ivy-mystuff.services.common.xml" pomfile="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/poms/mystuff.services.common.pom">
<mapping conf="default" scope="compile"/>
<mapping conf="runtime" scope="runtime"/>
</ivy:makepom>
Then a little hackery - I insert an artifact element in the ivy file using xml task. This works ok...
<xmltask source="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/ivy-${resolved.revision}.xml" dest="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/ivy-${resolved.revision}.xml">
<insert path="/ivy-module/publications" >
<![CDATA[
<artifact name="mystuff.services.common" type="pom"/>
]]>
</insert>
</xmltask>
Then I resolve/deliver/publish, as per various docs I've seen on how to do this.
<ivy:resolve file="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/ivy-${resolved.revision}.xml"/>
<!--<echoproperties/>-->
<ivy:deliver conf="*" delivertarget="recursive-deliver"/>
<ivy:publish resolver="myrepo-publish" publishivy="false" overwrite="true">
<artifacts pattern="lib/myorg/[module]/[type]s/[artifact].[ext]"/>
</ivy:publish>
And the error I get:
build.xml:235: impossible to publish artifacts for
myorg#mystuff.services.common;1.0.1: java.io.IOException: missing artifact
myorg#mystuff.services.common;1.0.1!mystuff.services.common.pom
If I leave out the pom from the artifacts in the ivy file, the other artifacts just publish fine.
What am I doing wrong?
This is what the ivy file looks like after inserting the pom entry for artifacts
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../ivy-doc.xsl"?>
<ivy-module version="1.0">
<info organisation="myorg" module="mystuff.services.common" revision="1.0.1" status="integration" publication="20130206204156"/>
<configurations>
<conf name="default"/>
<conf name="compile" extends="default"/>
</configurations>
<publications>
<artifact name="services.common" type="jar" conf="compile"/>
<artifact name="services.common~test" type="jar" conf="compile"/>
<artifact name="services.common" type="javadoc-zip" ext="zip" conf="compile"/>
<artifact name="services.common~test" type="javadoc-zip" ext="zip" conf="compile"/>
<artifact name="services.common" type="src-zip" ext="zip" conf="compile"/>
<artifact name="services.common~test" type="src-zip" ext="zip" conf="compile"/>
<artifact name="com.myorg.mystuffservices.common" type="osgi-module" ext="jar" conf="compile"/>
<artifact name="services.common" type="pom"/>
</publications>
<dependencies>
<dependency org="org.testng" name="testng" rev="5.11" conf="compile->compile-15"/>
</dependencies>
</ivy-module>
Your publish does not have an artifact pattern that finds the pom generated by your "makepom" task.
Either change the location or alternatively add an extra artifacts tag to your publish task:
<ivy:publish resolver="myrepo-publish" publishivy="false" overwrite="true">
<artifacts pattern="lib/myorg/[module]/[type]s/[artifact].[ext]"/>
<artifacts pattern="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/poms/mystuff.services.common.pom"/>
</ivy:publish>
I also don't understand why you're inserting a POM entry into you ivy file. Why don't you just list in your publications section?
For a detailed example see:
how to publish 3rdparty artifacts with ivy and nexus