Maven,包不存在

编程入门 行业动态 更新时间:2024-10-27 13:32:43
本文介绍了Maven,包不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个模块,其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,包不存在

本文发布于:2023-06-08 06:29:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/576122.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不存在   Maven

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!