开发者

Netbeans project to scripted build

I'm trying to convert a Netbeans 6.9.1 project into a scripted build (without netbeans). Of course, it fails (or I wouldn't be asking for help).

In the failure it says that the org.apache.commons.httpclient package does not exist. (Of course, it worked when we ran the build in Netbeans).

Now I know exactly where the commons-httpclient.jar file is located in my project structure, but I can't seem to tell it to the compiler via the ant build files and the netbeans property files.

Perhaps related to this is when I ran "ant -v" to build my software, it said,

Property lib.mystuff.classpath has not been set. This variable is important, I guess, because

the file nbproject/project.properties uses lib.mystuff.classpath in its definition of javac.classpath, which of course tells the Java compiler where to find the JARs.

So...when moving a Netbeans project to a netbeans-independent scripted build, how can the build script set these properties? Also, how can I ensure that the jar file gets included in the ant build?

I appreciate any help I can get, as I am a Java newbie.

UPDATE AFTER ACCEPTING ANSWER FROM vkraemer:

There are a few best practices for build scripts for production software:

  1. Put everything needed for a build under a single directory tree. (Netbeans = fail)
  2. Put everything in source code control. (I did that)
  3. The first line of the build script should clear all environment variables.
  4. The next section of the build script should explicitly set all environment variables to values which are known to work.开发者_如何学编程
  5. The next part of the build should be able to execute using command-line programs such as javac, ant, cc, etc, and must not depend on firing up an IDE such as Eclipse or Netbeans.

It is a shame that Netbeans makes this hard.


I did a quick look in a Java Application project and found the following...

javac.classpath = ${libs.MyStuff.classpath}

libs.MyStuff.classpath is defined in %HOME%/.netbeans/6.9.1/build.properties.

You may be able to get by doing the following...

ant -Dlibs.MyStuff.classpath=c:\a\b\c.jar

You would need to do more if you have multiple jar files in the MyStuff library that you created in NetBeans.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜