Using Apache Ivy with netbeans

I have an existing project that is developed using netbeans, and I would like to integrate Apache Ivy into the project. I updated the build.xml created by netbeans to download ivy (if necessary) and use it to get dependencies.

Does anyone know how I can add downloaded dependencies to the project build path so that it compiles, and also so that it does not detect missing library errors in the interface.

I would prefer to do this without using the netbeans plugin, if possible. If not, which plugin would you recommend using.

EDIT: I am also doing this in the target program "-pre-init" right now, if that makes any difference.

+1
source share
3 answers

Unfortunately, I am not familiar with the netbeans configuration file.

The following is the integration goal that I used to generate Eclipse metadata files:

  • .classpath
  • .project

Perhaps you could adapt it.

<target name="eclipse"> <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="build.path"/> <ivy:cachefileset setid="libfiles" conf="compile"/> <groovy> <arg value="${src.dir}"/> <arg value="${build.dir}/classes"/> import groovy.xml.MarkupBuilder // // Generate the project file // project.log("Creating .project") new File(".project").withWriter { writer -> def xml = new MarkupBuilder(writer) xml.projectDescription() { name(project.name) comment() projects() buildSpec() { buildCommand() { name("org.eclipse.jdt.core.javabuilder") arguments() } } natures() { nature("org.eclipse.jdt.core.javanature") } } } // // Generate the classpath file // // The "lib" classpathentry fields are populated using the ivy artifact report // project.log("Creating .classpath") new File(".classpath").withWriter { writer -> def xml = new MarkupBuilder(writer) xml.classpath() { classpathentry(kind:"src", path:args[0]) classpathentry(kind:"output", path:args[1]) classpathentry(kind:"con", path:"org.eclipse.jdt.launching.JRE_CONTAINER") project.references.libfiles.each { classpathentry(kind:"lib", path:it) } } } </groovy> </target> 
+1
source
0
source

If you don't want to use the ivybeans plugin, perhaps you can inspire yourself to another ant task generated by the plugin:

https://code.google.com/p/ivybeans/source/browse/trunk/ivybeans/ivy-module/src/com/googlecode/ivybeans/module/resources/ivy-impl_.xml

0
source

Source: https://habr.com/ru/post/946508/


All Articles