如何通过从 github 导入 Eclipse 中的 运行 Maven 项目

How to run Maven project in Eclipse by importing it from github

我是 Java 和 maven 的新手,我只需要 运行 这个 https://github.com/att/XACML Maven 项目。

任何人都请给我一些指导,因为如果我在 Eclipse 中构建它,我会遇到这些错误。
我需要安装 gpg 软件,因为我对 gpg 了解不多,因为我是新手。

[INFO] --- maven-failsafe-plugin:2.19.1:verify (integration-tests) @ att-xacml ---
[INFO] 
[INFO] --- maven-gpg-plugin:1.5:sign (sign-artifacts) @ att-xacml ---
'gpg.exe' is not recognized as an internal or external command,
operable program or batch file.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] ATT XACML 2.0.0-SNAPSHOT ........................... FAILURE [ 19.653 s]
[INFO] att-xacml .......................................... SKIPPED
[INFO] att-xacml-pip ...................................... SKIPPED
[INFO] att-xacml-pdp ...................................... SKIPPED
[INFO] xacml-test ......................................... SKIPPED
[INFO] xacml-rest ......................................... SKIPPED
[INFO] xacml-pdp-rest ..................................... SKIPPED
[INFO] xacml-pap-rest ..................................... SKIPPED
[INFO] xacml-pap-admin 2.0.0-SNAPSHOT ..................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:54 min 

一旦成功,我将需要知道如何 运行:

mvn jetty:run-war

错误消息中重要的部分只是上面你发布的内容。
例如参见 [​​=19=]:

[INFO] --- maven-gpg-plugin:1.5:sign (sign-artifacts) @ att-xacml ---
gpg: signing failed: Inappropriate ioctl for device
gpg: signing failed: Inappropriate ioctl for device
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ATT XACML .......................................... FAILURE [  2.712 s]

该错误已通过 Java 更新解决,因此请仔细检查您在 Eclipse 中使用的 Java。


在 OP 的情况下,错误是:

'gpg.exe' is not recognized as an internal or external command,
operable program or batch file.

这仅仅意味着您需要从识别 gpg.exe 的 CMD 会话中启动 Eclipse:

gpg.exe --version
gpg (GnuPG) 2.0.29 (Gpg4win 2.3.0)

在 CMD 中检查您的 %PATH%

set PATH

并进行相应调整:

set PATH=C:\path\to\gpg;%PATH%

然后启动 Eclipse,并在其中安装 maven。


OP 添加:

how I am able to access the console of local host?
Like where I can run this command (mvn jetty:run-war) and how.

参见“Is there any tool in eclipse to run maven commands directly?": assuming you have m2e (M2Eclipse) already installed with you Eclipse, you will be able to define a maven "run configuration"

在“Sonatype: Developing with Eclipse and Maven / 4.2. Running Maven Builds”中查看更多信息。

具体mvn jetty:run,参见“how to run a web service maven project on jetty 8 from eclipse?”。