gpt4 book ai didi

java - 运行 mvn exec :java from a remote directory not containing the pom. xml

转载 作者:行者123 更新时间:2023-12-03 17:43:52 24 4
gpt4 key购买 nike

我在“/some/where”中构建了一个 Maven 项目,我希望从另一个目录“/foo/bar”运行/执行它。我目前正在运行如下命令:

cd /some/where
mvn exec:java -Dexec.mainClass=org.xmlcml.cml.rest.Client

/some/where/pom.xml

我想做这样的事情:

cd /foo/bar
mvn -p /some/where/pom.xml exec:java -Dexec.mainClass=org.xmlcml.cml.rest.Client

但不知道语法或是否允许。

如果允许相对文件名引用到 (a) 包含 pom.xml 的目录,即 /some/where 或 (b) 当前目录 /foo/bar

最佳答案

试试这个:

mvn -f /some/where/pom.xml exec:java -Dexec.mainClass=org.xmlcml.cml.rest.Client

找出 maven 命令行选项:

mvn --help

If it is allowed where are relative filenames referenced to (a) the directory containing the pom.xml , i.e. /some/where or (b) the current directory /foo/bar

POM 文件中的相对路径名是相对于包含 POM 的目录解析的。

关于java - 运行 mvn exec :java from a remote directory not containing the pom. xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3948316/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com