我有一个模块,其pom文件为:
I have a module whose pom file is:
<groupId>com.mycompany.Common</groupId> <artifactId>common</artifactId> <packaging>pom</packaging> <version>1.0-SNAPSHOT</version> <name>common module</name>在该工件(普通")中,我有一个名为com.mycompanymon.objects的软件包.在使用程序包中,我的pom文件是:
In that artifact ('common'), I have a package named com.mycompanymon.objects. In the consuming package, my pom file is:
<dependency> <groupId>com.mycompany.Common</groupId> <artifactId>common</artifactId> <version>1.0-SNAPSHOT</version> <type>pom</type> </dependency>当我运行mvn install时,总是会抱怨:包com.mycompanymon.objects不存在.
When I run mvn install it always complain: package com.mycompanymon.objects does not exist.
我尝试在错误所在的类中明确导入:
I tried explicit importing in the class where the error was:
import com.mycompanymon.objects没有运气.我在IDE(IntelliJ)和命令行中都尝试过.任何的想法?谢谢
No luck. I tried in both the IDE (IntelliJ) and in commandline. Any idea? thanks
推荐答案从您的示例中,我们看不到任何包含您正在使用的软件包com.mycompanymon.objects的工件.
From your sample, we cannot see any artifact containing the package com.mycompanymon.objects you are using.
您正在将com.mycompany.Common:common依赖项添加为POM(并且还将com.mycompany.Common:common的包装也声明为POM).如果它实际上是一个JAR工件,其中包含您需要使用的软件包,则从POM和依赖项中删除packaging(这意味着,使用默认值JAR).
You are adding dependency com.mycompany.Common:common as a POM (and you are declaring the packaging of com.mycompany.Common:common as POM too). If it is actually a JAR artifact that contains the package you need to use, then remove the packaging from the POM and dependency (which means, using default which is JAR).
更多推荐
Maven,包不存在
发布评论