- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我们使用 Netbeans 生成 Ant 构建文件并进行一些小的调整。这使我们能够在 Netbeans 内部构建我们的项目,并在命令行上运行 ant 以在 Netbeans 外部构建我们的项目。后者对于诸如完全重建或 Jenkins 持续构建和测试之类的事情很有用。
我们会根据需要自定义 build.xml 文件,这对我们在 Netbeans 8.2 和之前的版本上运行良好,但对于 Netbeans pre-9(包括 201708280001 在内的开发版本),Netbeans 在运行时开始破坏我们的构建命令行。
我们收到以下错误:
BUILD FAILED
C:\Users\Stephen\hcs\orc.trunk\nb\build.xml:278: The following error occurred while executing this line:
C:\Users\Stephen\hcs\orc.trunk\nb\build.xml:229: The following error occurred while executing this line:
C:\Users\Stephen\hcs\orc.trunk\nb\ServerLibWOC\nbproject\build-impl.xml:1623: Unknown attribute [modulepath]
Total time: 2 minutes 35 seconds
在 Netbeans 内部构建时,它可以正常工作。
如果我手动检查所有 build-impl.xml 文件,我可以删除模块路径引用,构建在命令行和 Netbeans 上都能正常工作,但最终 Netbeans 将重新引入模块路径设置。因此,这不是一个令人满意的长期解决方案。
我已经尝试升级到最新版本的 Ant (1.9.9) 和 Netbeans Dev,但没有任何效果。我假设有一些库是 Netbeans 随其 Ant 版本一起提供的,但我的库存 Ant 1.9.9 中没有,但我不知道它是什么。
有没有人找到让 Ant 从命令行正确构建 Netbeans 项目的解决方案?
更新 1
尝试使用 Ant 1.10.1,结果相同。
更新 2
在 Java 9 下运行命令行 Ant 没有解决问题。
更新 3
将我的测试隔离到一个项目 (orcb) 并确保它在 Java9 下运行。仍然失败:
Stephen@Stephen-VPC ~/hcs/orc.trunk/nb/orcb
$ echo $JAVA_HOME
/cygdrive/c/jdk1.9.ea
Stephen@Stephen-VPC ~/hcs/orc.trunk/nb/orcb
$ java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
$ ./build.sh
Buildfile: C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build.xml
-pre-init:
-init-private:
-init-user:
-init-project:
-init-macrodef-property-impl:
-set-source-dir:
-init-macrodef-property:
-init-modules-supported:
-do-init:
-post-init:
-init-check:
-init-ap-cmdline-properties:
-init-macrodef-modulename:
-init-source-module-properties:
-init-macrodef-javac-with-module:
-init-which-javac-to-use:
-init-macrodef-javac-with-processors.java.1.8:
-init-macrodef-javac-with-processors.java.9:
-init-macrodef-javac-with-processors:
-init-macrodef-javac-without-processors.java.1.8:
-init-macrodef-javac-without-processors.java.9:
-init-macrodef-javac-without-processors:
-init-macrodef-javac:
-init-macrodef-test-impl:
-init-macrodef-junit-init:
-init-test-properties:
-init-macrodef-junit-prototype-with-module:
-init-macrodef-junit-prototype-without-module:
-init-macrodef-junit-single:
-init-macrodef-junit-batch:
-init-macrodef-junit:
-init-macrodef-junit-impl:
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/3:test-impl
-init-macrodef-testng:
-init-macrodef-testng-impl:
-init-macrodef-test:
-init-macrodef-junit-debug-impl:
-init-macrodef-test-debug-junit:
-init-macrodef-testng-debug:
-init-macrodef-testng-debug-impl:
-init-macrodef-test-debug-testng:
-init-macrodef-test-debug:
-init-debug-args:
-init-macrodef-nbjpda:
-init-macrodef-debug:
-init-macrodef-java-with-module:
-init-macrodef-java-with-unnamed-module:
-init-macrodef-java-without-module:
-init-macrodef-java:
-init-presetdef-jar:
-init-ap-cmdline-supported:
-init-ap-cmdline:
init:
-deps-clean-init:
deps-clean:
-do-clean:
[delete] Deleting directory C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build
-post-clean:
clean:
-pre-init:
-init-private:
-init-user:
-init-project:
-init-macrodef-property-impl:
-set-source-dir:
-init-macrodef-property:
-init-modules-supported:
-do-init:
-post-init:
-init-check:
-init-ap-cmdline-properties:
-init-macrodef-modulename:
-init-source-module-properties:
-init-macrodef-javac-with-module:
-init-which-javac-to-use:
-init-macrodef-javac-with-processors.java.1.8:
-init-macrodef-javac-with-processors.java.9:
-init-macrodef-javac-with-processors:
-init-macrodef-javac-without-processors.java.1.8:
-init-macrodef-javac-without-processors.java.9:
-init-macrodef-javac-without-processors:
-init-macrodef-javac:
-init-macrodef-test-impl:
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/3:test-impl
-init-macrodef-junit-init:
-init-test-properties:
-init-macrodef-junit-prototype-with-module:
-init-macrodef-junit-prototype-without-module:
-init-macrodef-junit-single:
-init-macrodef-junit-batch:
-init-macrodef-junit:
-init-macrodef-junit-impl:
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/3:test-impl
-init-macrodef-testng:
-init-macrodef-testng-impl:
-init-macrodef-test:
-init-macrodef-junit-debug-impl:
-init-macrodef-test-debug-junit:
-init-macrodef-testng-debug:
-init-macrodef-testng-debug-impl:
-init-macrodef-test-debug-testng:
-init-macrodef-test-debug:
-init-debug-args:
-init-macrodef-nbjpda:
-init-macrodef-debug:
-init-macrodef-java-with-module:
-init-macrodef-java-with-unnamed-module:
-init-macrodef-java-without-module:
-init-macrodef-java:
-init-presetdef-jar:
-init-ap-cmdline-supported:
-init-ap-cmdline:
init:
-deps-jar-init:
deps-jar:
-check-automatic-build:
-clean-after-automatic-build:
-verify-automatic-build:
-pre-pre-compile:
[mkdir] Created dir: C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
-add-build-versions-status:
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
-pre-compile:
-copy-persistence-xml:
-compile-depend:
-do-compile:
[mkdir] Created dir: C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\empty
[mkdir] Created dir: C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\generated-sources\ap-source-output
[javac] Compiling 1058 source files to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[javac] warning: [options] source value 1.6 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.6 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 3 warnings
[copy] Copying 35 files to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
-init-check-cobertura:
-instrument-coverage:
-post-compile:
compile:
-pre-jar:
-check-module-main-class:
-set-module-main-class:
-pre-pre-jar:
[mkdir] Created dir: C:\Users\Stephen\hcs\orc.trunk\nb\orcb\dist
-do-jar-create-manifest:
-do-jar-copy-manifest:
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build
-do-jar-set-mainclass:
-do-jar-set-profile:
-do-jar-set-splashscreen:
-do-jar-jar:
-init-macrodef-copylibs:
-do-jar-copylibs:
[copylibs] Copy libraries to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\dist\lib.
[copylibs] Building jar: C:\Users\Stephen\hcs\orc.trunk\nb\orcb\dist\ORMC.jar
[echo] To run this application from the command line without Ant, try:
[echo] java -jar "C:\Users\Stephen\hcs\orc.trunk\nb\orcb\dist\ORMC.jar"
-do-jar-delete-manifest:
-do-jar-without-libraries:
-do-jar-with-libraries:
-post-jar:
[mkdir] Created dir: C:\Users\Stephen\hcs\orc.trunk\nb\orcb\dist\signed
[jar] Building jar: C:\Users\Stephen\hcs\orc.trunk\nb\orcb\dist\signed\ORMC.jar
-do-jar:
-pre-deploy:
-check-jlink:
-do-deploy:
-post-deploy:
deploy:
-check-filename-prop:
-set-jnlp-filename-custom:
-set-jnlp-filename-default:
-init-filename:
-test-jnlp-enabled:
-create-tmp-manifest:
-copy-tmp-manifest:
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build
-security-props-check:
-test-signjars-task-available:
-unavailable-signjars-task:
-check-signing-possible:
-set-mixed-code-properties:
-init-macrodef-extend-manifest:
-add-trusted-only-attribute:
-add-trusted-library-attribute:
-check-manifest-codebase:
-extend-manifest-codebase-copy:
-extend-manifest-codebase-web:
-extend-manifest-codebase-other:
-extend-manifest-codebase-override-warning:
-extend-manifest-codebase-override:
-check-manifest-permissions:
-extend-manifest-permissions-sandbox:
-extend-manifest-permissions-all:
-extend-manifest-permissions-override:
-extend-manifest-application-name:
-check-manifest-application-library-allowable-codebase:
-extend-manifest-application-library-allowable-codebase-copy:
-extend-manifest-application-library-allowable-codebase-web:
-extend-manifest-application-library-allowable-codebase-other:
-extend-manifest-application-library-allowable-codebase-override-warning:
-extend-manifest-application-library-allowable-codebase-override:
-check-manifest-caller-allowable-codebase:
-extend-manifest-caller-allowable-codebase-copy:
-extend-manifest-caller-allowable-codebase-web:
-extend-manifest-caller-allowable-codebase-other:
-extend-manifest-caller-allowable-codebase-override-warning:
-extend-manifest-caller-allowable-codebase-override:
-add-manifest-security:
-test-jnlp-type:
-do-jar-applet:
-do-jar-jnlp-application:
-do-jar-jnlp-component:
-do-jar-jnlp:
jnlp:
jar:
-pre-init:
-init-private:
-init-user:
-init-project:
-init-macrodef-property-impl:
-set-source-dir:
-init-macrodef-property:
-init-modules-supported:
-do-init:
-post-init:
-init-check:
-init-ap-cmdline-properties:
-init-macrodef-modulename:
-init-source-module-properties:
-init-macrodef-javac-with-module:
-init-which-javac-to-use:
-init-macrodef-javac-with-processors.java.1.8:
-init-macrodef-javac-with-processors.java.9:
-init-macrodef-javac-with-processors:
-init-macrodef-javac-without-processors.java.1.8:
-init-macrodef-javac-without-processors.java.9:
-init-macrodef-javac-without-processors:
-init-macrodef-javac:
-init-macrodef-test-impl:
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/3:test-impl
-init-macrodef-junit-init:
-init-test-properties:
-init-macrodef-junit-prototype-with-module:
-init-macrodef-junit-prototype-without-module:
-init-macrodef-junit-single:
-init-macrodef-junit-batch:
-init-macrodef-junit:
-init-macrodef-junit-impl:
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/3:test-impl
-init-macrodef-testng:
-init-macrodef-testng-impl:
-init-macrodef-test:
-init-macrodef-junit-debug-impl:
-init-macrodef-test-debug-junit:
-init-macrodef-testng-debug:
-init-macrodef-testng-debug-impl:
-init-macrodef-test-debug-testng:
-init-macrodef-test-debug:
-init-debug-args:
-init-macrodef-nbjpda:
-init-macrodef-debug:
-init-macrodef-java-with-module:
-init-macrodef-java-with-unnamed-module:
-init-macrodef-java-without-module:
-init-macrodef-java:
-init-presetdef-jar:
-init-ap-cmdline-supported:
-init-ap-cmdline:
init:
-deps-jar-init:
deps-jar:
-check-automatic-build:
-clean-after-automatic-build:
-verify-automatic-build:
-pre-pre-compile:
-add-build-versions-status:
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
[copy] Copying 1 file to C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\classes
-pre-compile:
-copy-persistence-xml:
-compile-depend:
-do-compile:
-init-check-cobertura:
-instrument-coverage:
-post-compile:
compile:
-pre-pre-compile-test:
[mkdir] Created dir: C:\Users\Stephen\hcs\orc.trunk\nb\orcb\build\test\classes
-pre-compile-test:
-init-test-javac-module-properties-with-module:
-init-test-module-properties-without-module:
-init-test-module-properties:
-compile-test-depend:
-do-compile-test:
BUILD FAILED
C:\Users\Stephen\hcs\orc.trunk\nb\orcb\nbproject\build-impl.xml:1660: Unknown attribute [modulepath]
Total time: 25 seconds
注意关于source 1.6的警告,这是Java9中的新警告。这是因为需要构建我们的代码以便它可以在较旧的 JVM 下运行(我们无法成功插入客户升级)。
build.sh 内容如下:
$ cat build.sh
export JAVA_HOME=/cygdrive/c/jdk1.9.ea
"c:/Program Files (x86)/NetBeans Dev 201709180002/extide/ant/bin/ant" -Dplatforms.JDK32_1.6.home=c:/jdk1.6.0_43 -Dplatforms.JDK32_1.7.home=C:/jdk_1.7.0_79/ -Dlibs.CopyLibs.classpath=C:/Users/Stephen/hcs/orc.trunk/lib/netbeans/org-netbeans-modules-java-j2seproject-copylibstask.jar clean jar compile-test
注意:平台引用用于确保我们针对旧版本的 Java 正确构建。
用 Netbeans 打开了一张票: https://netbeans.org/bugzilla/show_bug.cgi?id=271487
更新 4
新工单:https://issues.apache.org/jira/browse/NETBEANS-1106
更新 5
这也会影响 Netbeans 11,如果您使用的是 Java 1.8 或更早版本,甚至无法在 Netbeans 中正确构建。
最佳答案
将问题追踪到我们自己的一个构建脚本中的问题。为了解决不同的 Netbeans 问题,我们定义了自己的宏:
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
在那里,对于 Java 1.8,我们没有处理我们添加的 modulepath 属性:
<attribute default="${empty.dir}" name="modulepath"/>
这似乎解决了我们的问题。
关于java - Netbeans Dev (9.x) Java 项目不会在 Netbeans 之外构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46244201/
我正在编写一个具有以下签名的 Java 方法。 void Logger(Method method, Object[] args); 如果一个方法(例如 ABC() )调用此方法 Logger,它应该
我是 Java 新手。 我的问题是我的 Java 程序找不到我试图用作的图像文件一个 JButton。 (目前这段代码什么也没做,因为我只是得到了想要的外观第一的)。这是我的主课 代码: packag
好的,今天我在接受采访,我已经编写 Java 代码多年了。采访中说“Java 垃圾收集是一个棘手的问题,我有几个 friend 一直在努力弄清楚。你在这方面做得怎么样?”。她是想骗我吗?还是我的一生都
我的 friend 给了我一个谜语让我解开。它是这样的: There are 100 people. Each one of them, in his turn, does the following
如果我将使用 Java 5 代码的应用程序编译成字节码,生成的 .class 文件是否能够在 Java 1.4 下运行? 如果后者可以工作并且我正在尝试在我的 Java 1.4 应用程序中使用 Jav
有关于why Java doesn't support unsigned types的问题以及一些关于处理无符号类型的问题。我做了一些搜索,似乎 Scala 也不支持无符号数据类型。限制是Java和S
我只是想知道在一个 java 版本中生成的字节码是否可以在其他 java 版本上运行 最佳答案 通常,字节码无需修改即可在 较新 版本的 Java 上运行。它不会在旧版本上运行,除非您使用特殊参数 (
我有一个关于在命令提示符下执行 java 程序的基本问题。 在某些机器上我们需要指定 -cp 。 (类路径)同时执行java程序 (test为java文件名与.class文件存在于同一目录下) jav
我已经阅读 StackOverflow 有一段时间了,现在我才鼓起勇气提出问题。我今年 20 岁,目前在我的家乡(罗马尼亚克卢日-纳波卡)就读 IT 大学。足以介绍:D。 基本上,我有一家提供簿记应用
我有 public JSONObject parseXML(String xml) { JSONObject jsonObject = XML.toJSONObject(xml); r
我已经在 Java 中实现了带有动态类型的简单解释语言。不幸的是我遇到了以下问题。测试时如下代码: def main() { def ks = Map[[1, 2]].keySet()
一直提示输入 1 到 10 的数字 - 结果应将 st、rd、th 和 nd 添加到数字中。编写一个程序,提示用户输入 1 到 10 之间的任意整数,然后以序数形式显示该整数并附加后缀。 public
我有这个 DownloadFile.java 并按预期下载该文件: import java.io.*; import java.net.URL; public class DownloadFile {
我想在 GUI 上添加延迟。我放置了 2 个 for 循环,然后重新绘制了一个标签,但这 2 个 for 循环一个接一个地执行,并且标签被重新绘制到最后一个。 我能做什么? for(int i=0;
我正在对对象 Student 的列表项进行一些测试,但是我更喜欢在 java 类对象中创建硬编码列表,然后从那里提取数据,而不是连接到数据库并在结果集中选择记录。然而,自从我这样做以来已经很长时间了,
我知道对象创建分为三个部分: 声明 实例化 初始化 classA{} classB extends classA{} classA obj = new classB(1,1); 实例化 它必须使用
我有兴趣使用 GPRS 构建车辆跟踪系统。但是,我有一些问题要问以前做过此操作的人: GPRS 是最好的技术吗?人们意识到任何问题吗? 我计划使用 Java/Java EE - 有更好的技术吗? 如果
我可以通过递归方法反转数组,例如:数组={1,2,3,4,5} 数组结果={5,4,3,2,1}但我的结果是相同的数组,我不知道为什么,请帮助我。 public class Recursion { p
有这样的标准方式吗? 包括 Java源代码-测试代码- Ant 或 Maven联合单元持续集成(可能是巡航控制)ClearCase 版本控制工具部署到应用服务器 最后我希望有一个自动构建和集成环境。
我什至不知道这是否可能,我非常怀疑它是否可能,但如果可以,您能告诉我怎么做吗?我只是想知道如何从打印机打印一些文本。 有什么想法吗? 最佳答案 这里有更简单的事情。 import javax.swin
我是一名优秀的程序员,十分优秀!