使用Apache常春藤与NetBeans [英] Using Apache Ivy with netbeans

查看:203
本文介绍了使用Apache常春藤与NetBeans的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用NetBeans开发现有项目,我想阿帕奇常青藤项目集成。我更新通过NetBeans的生成下载常春藤(必要时应),并用它来检索依赖的build.xml文件。

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

有谁知道我可以下载的依赖关系添加到项目中,这样它将编译正常的构建路径,也使得它不显示在界面中缺少库的错误。

Does anyone know how I can add the downloaded dependencies to the build path of the project, such that it will compile okay and also so that it doesn't show missing libraries errors in the interface.

我想preFER要做到这一点,而不使用的NetBeans插件,如果这是可能的。如果没有,你会建议使用什么插件。

I would prefer to do this without using a netbeans plugin if this is possible. If not, what plugin would you recommend using.

编辑:另外我在此doint - pre-初始化的目标,现在,如果它是任何意义的。

Also I am doint this in the "-pre-init" target right now, if it is of any relevance.

推荐答案

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

Unfortunately I'm not familiar with netbeans' configuration file.

下面是一个整合的目标我用来生成的Eclipse元数据文件:

The following is an integration target I used to generate Eclipse metadata files:


  • 的.classpath

  • 的.project

也许你能够适应它。

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

这篇关于使用Apache常春藤与NetBeans的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆