提问者:小点点

将Apache Ivy与netbeans一起使用


我有一个使用netbeans开发的现有项目,我想在项目中集成Apache Ivy。我更新了netbeans生成的build.xml来下载ivy(如果必要的话),并使用它来检索依赖项。

有没有人知道我如何将下载的依赖项添加到项目的构建路径中,这样它就可以正常编译,并且不会在接口中显示缺少的库错误。

如果可能的话,我更愿意在不使用netbeans插件的情况下这样做。如果没有,您建议使用什么插件。

编辑:我现在也在“-pre-init”目标中做这件事,如果它有任何关联的话。


共3个答案

匿名用户

不幸的是,我不熟悉netbeans的配置文件。

以下是我用来生成Eclipse元数据文件的集成目标:

    <李>。类路径 <李>。项目

也许你可以改编它。

<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>

匿名用户

也许你可以试试http://code.google.com/p/ivybeans/

匿名用户

如果您不想使用ivybean插件,也许您可以激发自己对插件生成的不同蚂蚁任务的兴趣:

https://code . Google . com/p/ivy beans/source/browse/trunk/ivy beans/ivy-module/src/com/Google code/ivy beans/module/resources/ivy-impl _。可扩展标记语言