问题描述
sample1
src / main / java
com.folder.name。我们的样本2包含 com.folder.name.we.like
和 App.java
我要添加 sample2
作为 sample1的依赖关系
修改的pom.xml如下
< dependency>
< groupId> com.folder.name.we.like< / groupId>
< artifactId> sample2< / artifactId>
< version> 1.0-SNAPSHOT< / version>
< / dependency>
我有 sample2-1.0-SNAPSHOT.jar
在我的存储库也。但是我检查eclipse下的maven依赖文件夹。它有 junit jar [另一个依赖关系]和wmpty sample2文件夹
为什么?我如何在这里添加我的jar?
我需要在依赖关系中使用 systempath和系统范围
?任何原因?
编辑
sample1协调:
< groupId> com.folder.name.we.like1< / groupId>
< artifactId> sample1< / artifactId>
< version> 1.0-SNAPSHOT< / version>
< packaging> jar< / packaging>
sample2:
code>< groupId> com.folder.name.we.like< / groupId>
< artifactId> sample2< / artifactId>
< version> 1.0-SNAPSHOT< / version>
< packaging> jar< / packaging>
这实际上是标准的Eclipse foo,显示了这样的文件夹。它代表您在Eclipse中其他地方开放的项目。它不会重复整个树,因为您可以从 sample2
项目获取它。
如果你'选择属性
然后选择 Maven
并取消选中从Workspace项目中解析依赖项复选框。
Dir Structure:
sample1
src/main/java
com.folder.name.we.like1
App.java
Similarly i have sample2 which contains com.folder.name.we.like
and App.java
I want to add sample2
as a dependency for sample1
modified pom.xml as follows
<dependency>
<groupId>com.folder.name.we.like</groupId>
<artifactId>sample2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
I have sample2-1.0-SNAPSHOT.jar
in my repository also. But i check the maven dependencies folder under eclipse. It has junit jar[another dependency] and wmpty sample2 folder
Why? How do i add my jar here?
Do i need to use systempath and system scope in my dependency
? Any reasons?
EDIT
sample1 co-ordinate:
<groupId>com.folder.name.we.like1</groupId>
<artifactId>sample1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
sample2:
<groupId>com.folder.name.we.like</groupId>
<artifactId>sample2</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
That's actually standard Eclipse foo, showing the folder like that. It represents a project you have open elsewhere in Eclipse. It doesn't duplicate the whole tree because you can get to it from the sample2
project.
If you'd rather see it as a jar like any other, right-click on the project, select Properties
and then select Maven
and uncheck the "Resolve dependencies from Workspace projects" checkbox.
这篇关于Maven依赖关系是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!