I want to have a JAR file repository on my local network so all other Eclipse users use the same JAR files in Repository for their dependencies. I don't want Maven or Ant, I just want to use Ivy to share my JAR files, how do I do this? which XML file should I use? Can't find a simple solution online.
For start here is an example of ivy.xml file
<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="[your organization]"
module="your module[for example commons-io]"
status="integration">
</info>
<publications>
<artifact name="[your jar name]" ext="jar"/>
</publications>
Second an important step is creating an ivy.settings file.
<ivysettings>
<resolvers>
<filesystem name="public">
<ivy pattern="/path/to/my/public/rep/[organisation]/[module]/ivy-[revision].xml" />
<artifact pattern="/path/to/my/public/rep/[organisation]/[module]/[artifact]-[revision].[ext]" />
</filesystem>
</resolvers>
</ivysettings>
This is just part of the ivy.setting file and the resolver name should represent
your own repository for publications and downloading jars from your local network .
Read more about Adjusting ivy settings on http://ant.apache.org/ivy/history/2.1.0/tutorial/defaultconf.html
.
How ever ivy can't do the publish work for you ,and you will have to use ant
just small build.xml file .
Read on apache site http://ant.apache.org/ivy/history/2.2.0/use/publish.html
I hope it will be helpful.
Related
I need to resolve a jcuda native library via Ivy, but I'm having some trouble finding the right way to define the dependency.
I'm using Artifactory for my dependency management, and it properly identified and resolved the individual native library versions for all available plaforms (see screenshot):
However, I am stuck at the resolution of the
The error produced by Ivy shows the correct resolution path.
I found a hint in the original Maven definition for these libraries (found in my local Ivy cache, %HOME%\.ivy2\cache\org.jcuda\jcuda-natives\windows-x86_64\ivy-0.8.0.xml.original), which used the following classifier:
<classifier>${jcuda.os}-${jcuda.arch}</classifier>
In my Ivy configurations, I don't distinguish OS and architecture, but using the catenated classifier gives me windows-x86_64, which is the jar file I'm looking for.
I needed to add the Maven namespace (xmlns:maven="http://maven.apache.org") to 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" xmlns:maven="http://maven.apache.org">
And then the following dependency can use maven:classifier to resolve the specific native library I'm looking for:
<dependency org="org.jcuda" name="jcuda-natives" rev="0.8.0">
<artifact maven:classifier="windows-x86_64" ext="jar" />
</dependency>
Its maybe that I'm trying to misuse Ivy, but if I am then I definitely don't understand 'configurations'
I have a dependency I want to access only when running my build script under Jenkins. In my eclipse workspace I have no need for the dependency. Is it possible to achieve this?
For example if I wanted to pull ant-contrib in at build time I have tried setting up my configuration file as follows:
<configurations defaultconf="compile">
<conf name="compile" visibility="public" />
<conf name="build" visibility="public" extends="compile" />
</configurations>
<dependencies>
<dependency org="junit" name="junit" rev="4.8.1" conf="compile->default" />
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="build->*" />
</dependencies>
With this example I always end up with ant contrib and ant on my build path in eclipse which isn't what I wanted. The resolve ant task allows me to resolve a specific configuration so I assumed that IvyDE would only resolve the default one. What am I missing?
Thanks,
Dan.
When adding the ivy file using IvyDE it is possible to select the configurations that should be resolved. This way only compile can be selected and only junit would be resolved.
It seems that to change this you need to remove and re-add the ivy dependency, I can't find any settings to change the configurations without doing that.
Have added Ivy management to one of my eclipse projects. Nothing happened after that.
I have a guide to add something to ivy.xml and ivysettings.xml, so what? How to create empty versions of these files? Where to put them?
I have created some by intuition, in the project root, then added to files what was told.
Nothing happened. Where are new libraries? How to force Ivy to do something?
Versions:
Apache IvyDE 2.2.0.beta1-201203282058-RELEASE
Eclipse Helios Service Release 2
Guides for ivy are for xuggler: http://www.xuggle.com/downloads
I have created ivy.xml by File New and added what was said without ellipsis. icysettings.xml are just the sample w/o ellipsis.
Yes ivy.xml should be in the root (for default configuration).
try this:
<ivy-module
version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="com.organisation" module="stackoverflow" revision="1.0.0" status="integration" >
</info>
<configurations>
<conf name="default" />
</configurations>
<dependencies>
<dependency org="xuggle" name="xuggle-xuggler" rev="5.2" />
</dependencies>
</ivy-module>
Create ivysettings.xml file in the root as well. This one is adapted to your need
<ivysettings> <
settings defaultResolver="default" />
<include url="${ivy.default.settings.dir}/ivysettings.xml" />
<resolvers>
<url m2compatible="true" name="xugglecode">
<ivy
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organization]/[artifact]/[revision]/ivy-[revision].xml" />
<ivy
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organization]/[artifact]/ivy-[revision].xml" />
<artifact
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organisation]/[artifact]/[revision]/[artifact](-[revision]).[ext]" />
<artifact
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organisation]/[artifact]/[artifact](-[revision]).[ext]" />
<artifact
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organisation]/[artifact](-[revision]).[ext]" />
<artifact
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[artifact](-[revision]).[ext]" />
<artifact
pattern="http://build.xuggle.com/view/Stable/job/red5_jdk6_stable/lastSuccessfulBuild/artifact/workingcopy/dist/[artifact].[ext]" />
</url>
<chain name="default" changingPattern=".*SNAPSHOT">
<resolver ref="xugglecode" />
</chain>
</resolvers>
</ivysettings>
Now when you add ivy management, in Main tab you should see Ivy File: ivy.xml as default.
now go to settings tab. Check the box of 'Enable project specific settings'.
in Ivy settings path, easier to choose the one you just created in your root project using 'Workspace button'. Navigate and choose.
Press ok. It will start resolving immediately.
I should tell you, that even though the file exists, I couldn't retrieve it. The ivy- console seems stuck. I'm receiving Status Code 403. I'm doing from work.
Maybe you have better luck resolving it. If not, consider this as a mini example of how to set up IvyDE.
I'm getting this error when I try to add jruby as a dependency using the ivy Eclipse plugin:
Impossible to resolve dependencies of com.restphone#;working#James-Moores-iMac.local
unresolved dependency: org.jruby.extras#bytelist;1.0.8: not found
This is in my ivy.xml:
<dependency org="org.jruby"
name="jruby-complete"
rev="1.6.6" />
And this is in ivysettings.xml:
<ivysettings>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="codehaus" m2compatible="true" root="http://repository.codehaus.org/"/>
</chain>
</resolvers>
</ivysettings>
But according to the jruby mailing list, jruby has NO dependencies for runtime, compile or
test scope.
Do I need to give the ivy plugin more information somewhere?
In my opinion it's always a good idea to specify a configuration mapping for your dependencies.
The following ivy file worked fine for me. As described, only the ruby jar was downloaded.
<ivy-module version="2.0">
<info organisation="org.demo" module="demo"/>
<configurations>
<conf name="compile"/>
<conf name="runtime" extends="compile"/>
<conf name="test" extends="runtime"/>
</configurations>
<dependencies>
<dependency org="org.jruby" name="jruby-complete" rev="1.6.6" conf="compile->default"/>
</dependencies>
</ivy-module>
Here I have mapped my local "compile" configuration to the default remote configuration. (In a Maven module, the default ivy configuration translates to the "compile" scope).
I dug into the remote POM file:
<properties>
<jar.scope>provided</jar.scope>
..
..
<dependency>
<groupId>org.jruby.joni</groupId>
<artifactId>joni</artifactId>
<scope>${jar.scope}</scope>
</dependency>
<dependency>
<groupId>org.jruby.extras</groupId>
<artifactId>jnr-netdb</artifactId>
<scope>${jar.scope}</scope>
</dependency>
...
All the extra depedencies have been declared in the "provided" Maven scope.
Couple of issues:
1)
In Maven the provided scope is used for jars which are required for compiling that module. They do not need to be packaged because they are part of the target runtime environment. Similarily such dependencies are not needed as transitive dependencies for your module and hence don't need to downloaded.
2)
All the jars are all located in the Maven Central repository. The following settings file would retrieve everything, if you chose to omit the ivy configuration mapping
<ivysettings>
<property name="ivy.checksums" value=""/>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
3)
The following error is caused by a junk checksum. My provided settings file disables this check... something you are advised not to do on a remote repository
[ivy:resolve] :::: WARNINGS
[ivy:resolve] problem while downloading module descriptor: http://repo1.maven.org/maven2/org/jruby/extras/bytelist/1.0.8/bytelist-1.0.8.pom: invalid sha1: expected=e40ee094403473e43f71e21cf9cbf71f08d2098b computed=a9627bc7e42f886e290985367040794adb676320 (977ms)
[ivy:resolve] module not found: org.jruby.extras#bytelist;1.0.8
Although the JRuby docs may not state a required dependency, it looks as though the repository that you are using does...
You've asked for 'jruby-complete' and if you go and look at this POM you will see its specifying the jruby extras.
One option is to select a different POM file as the basis of your dependency, but a quick fix is to add the attribute transitive="false" to your dependency.
<dependency org="org.jruby"
name="jruby-complete"
transitive="false"
rev="1.6.6" />
I'm working on an automation project for my employer. We have a pool for each revision of our source code. When you download a revision, you need to create a directory structure with a bunch of third party includes to eventually build the project. I've automated this entire process up to the point of having my script (.bat) compile each particular runnable java application. There are many applications to this single project, and the directory listing looks something like this:
Proj Name
-variousincludesfolder1
-variousincludesfolder2
-variousincludesfolder3
-variousincludesfolder4
-runnableapplicationsandmoreincludes
-con.java
Right now, I'd like to do an automated compiling of con.java, but I don't know where to begin. People have suggested I try Ant, but any automated Ant file generation I get using Eclipse seems only enough to build con.java while an active project file exists. Is there anyway to automate this without using eclipse, to the point of having the batch file generate a .jar itself?
This is definitely a job for Ant. Don't rely on Eclipse-generated Ant files; read through the manual and write one yourself. (You'll likely find out that Ant does things you didn't think of doing in your build script, too.)
To be more specific, here is the documentation for the jar task.
You can define wildcard and pattern matches to include/exclude all sorts of files and folders in your build. Take a look at the Ant manual to see how things like filesets work with include and exclude filters.
Also, read the tutorial.
Here is a simple build file that looks to compile all java files and reference all jars. Place it in the top level directory:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl"
href="http://www.ibm.com/developerworks/xml/library/x-antxsl/examples/example2/ant2html.xsl"?>
<project name="Proj Name" default="build" basedir=".">
<property name="src.dir" value="${basedir}" description="base folder where the source files will be found. Typically under /src, but could be anywhere. Defaulting to root directory of the project" />
<property name="build.dir" value="build" description="Where to put build files, separate from src and resource files." />
<path id="master-classpath">
<fileset dir="${basedir}" description="looks for any jar file under the root directory">
<include name="**/*.jar" />
</fileset>
</path>
<target name="build" description="Compile all JAVA files in the project">
<javac srcdir="${src.dir}"
destdir="${build.dir}/classes"
debug="true"
deprecation="true"
verbose="false"
optimize="false"
failonerror="true">
<!--master-classpath is defined above to include any jar files in the project subdirectories(can be customized to include/exclude)-->
<classpath refid="master-classpath"/>
<!--If you want to define a pattern of files/folders to exclude from compilation...-->
<exclude name="**/realm/**"/>
</javac>
</target>
</project>