Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 当使用exec maven plugin:exec从Netbeans中运行文件时,如何在pom.xml中定义sys props?_Java_Maven_Netbeans - Fatal编程技术网

Java 当使用exec maven plugin:exec从Netbeans中运行文件时,如何在pom.xml中定义sys props?

Java 当使用exec maven plugin:exec从Netbeans中运行文件时,如何在pom.xml中定义sys props?,java,maven,netbeans,Java,Maven,Netbeans,当使用Netbeans时,在Maven项目中运行文件/类意味着Netbeans执行类似mvn exec:exec 现在我想从执行的类中访问maven sys prop${basedir}。我该怎么做?在pom.xml中设置命令行会覆盖Netbeans中的命令行,因此不起作用。将exec:java与exec-maven插件的sys-props配置部分一起使用也不起作用,因为我使用的是一个特殊的类重新加载程序,它只与exec:exec一起使用,但它找不到项目依赖类,因为默认加载程序似乎不同 有什么想

当使用Netbeans时,在Maven项目中运行文件/类意味着Netbeans执行类似mvn exec:exec

现在我想从执行的类中访问maven sys prop${basedir}。我该怎么做?在pom.xml中设置命令行会覆盖Netbeans中的命令行,因此不起作用。将exec:java与exec-maven插件的sys-props配置部分一起使用也不起作用,因为我使用的是一个特殊的类重新加载程序,它只与exec:exec一起使用,但它找不到项目依赖类,因为默认加载程序似乎不同


有什么想法吗?

将-Dbasedir=${basedir}添加到exec.args参数中可以工作:

exec.args=-classpath %classpath -Dbasedir=${basedir} ${packageClassName}
Netbeans不知道该变量,因此看起来exec maven插件会计算该字符串