无法使用exec-maven-plugin执行Maven多模块项目 [英] couldn't execute maven multi module project using exec-maven-plugin

查看:292
本文介绍了无法使用exec-maven-plugin执行Maven多模块项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多模块Maven项目此处.

I've a multi module maven project here .

父项目有3个通用的模块,带有-命名器,没有-命名器.

The parent project has 3 modules common, with-paranamer, without-paranamer.

with-paranamer和without-paranamer模块彼此独立,并且都依赖于公共模块.

The with-paranamer and without-paranamer modules are independent of each other and both are depend on common module.

在不带参数的模块中,我已对

In without-paranamer module I have added dependency to common module like this.

下面是项目的结构.

.
├── pom.xml
├── common
│   ├── pom.xml
│   ├─ src
│      ├── main
│         ├─ java
│            ├── ParanamerUtil.java
│            ├── PersonV03.java
│            └── TestCaseClasses.java
│
├── with-paranamer
│   ├── pom.xml
│   ├──src
│      ├── main
│         ├── java
│            └── ParanamerExample.java
|
└── without-paranamer
    ├── pom.xml
    ├─ src
       ├── main
          ├── java
              └── ParametersExample.java

我想使用exec-maven-plugin在不带paranamer的模块中执行ParametersExample类. 所以我在父pom.xml

I want to execute ParametersExample class in without-paranamer module using exec-maven-plugin. So I added exec-maven-plugin under pluginManagement in parent pom.xml here.
In without-paranamer module I have added plugin like this.

我已按照stackoverflow帖子中提到的上述说明进行操作>这里.

I've followed the above instructions as mentioned in the stackoverflow post here.

当我运行mvn verify时,命令成功.

When I run mvn verify the command is successful.

但是当我尝试执行命令mvn exec:java -Dexec.mainClass=ParametersExample -pl without-paranamer时,我遇到了错误消息.

But when I try riunning the command mvn exec:java -Dexec.mainClass=ParametersExample -pl without-paranamer I'm getting below error.

WARNING] The POM for paranamer-maven-demo:common:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.189 s
[INFO] Finished at: 2018-09-07T17:23:07-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project without-paranamer: Could not resolve dependencies for project paranamer-maven-demo:without-paranamer:jar:1.0-SNAPSHOT: Could not find artifact paranamer-maven-demo:common:jar:1.0-SNAPSHOT -> [Help 1]

如何使用exec-maven-plugin使程序成功运行.

How can I make my program run successful using the exec-maven-plugin.

推荐答案

without-paranamer模块具有对paranamer-maven-demo.common.1.0-SNAPSHOT的依赖,但是在哪里可以找到它?最明显的答案:在本地存储库中.但是它不存在,除非您安装它(还必须安装父项目的pom).

without-paranamer module has a dependency on paranamer-maven-demo.common.1.0-SNAPSHOT, but where can it finds it? Most obvious answer: in local repository. But its not there, unless you install it (also, you have to install pom of parent project).

mvn -N clean install-安装父pom.(-N代表non recursive,这意味着目标将仅针对父项目而不是子模块执行).

mvn -N clean install - installs parent pom.( -N stands for non recursive, which means goals will be executed only for parent project, and not for child modules).

mvn -pl common clean install-安装common模块.

现在,调用exec:java将成功(但由于插件管理配置中的<skip>true</skip>,因此未打印任何输出)

Now, calling exec:java will be successful (but didn't print any output, because of <skip>true</skip> in plugin management configuration)

这篇关于无法使用exec-maven-plugin执行Maven多模块项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆