我不确定我是否理解如何正确使用父pom项目.我定义了以下父pom:
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>../child1</module>
<module>../child2</module>
</modules>
Run Code Online (Sandbox Code Playgroud)
然后子节点pom引用父节点(每个子节点都有自己的一组依赖关系,这些依赖关系未显示):
<parent>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../Parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>child1</artifactId>
Run Code Online (Sandbox Code Playgroud)
这个设置工作正常,并在eclipse(m2eclipse)中正确解析.我可以将这些部署到我的本地存储库,最终得到以下结构,这应该是正确的:
--com
--example
--parent
--0.0.1-SNAPSHOT
--parent-0.0.1-SNAPSHOT.pom
--child1
--0.0.1-SNAPSHOT
--child1-0.0.1-SNAPSHOT.jar
--child1-0.0.1-SNAPSHOT.pom
--child2
--0.0.1-SNAPSHOT
--child2-0.0.1-SNAPSHOT.jar
--child2-0.0.1-SNAPSHOT.pom
Run Code Online (Sandbox Code Playgroud)
我的问题是我现在想要在不同的项目(不是parent,child1或child2)中引用父项目,从而引入所有父项的子项.我可以在我的其他项目中添加对它的引用:
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>pom</type>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
执行此操作时,项目在eclipse中没有显示任何错误,但是没有工件添加到我的类路径中:not child1,child2或它们的任何依赖项.
我一直认为必须有一种方法来拥有一个"主"pom项目,它本身不是一个罐子,但只引用其他罐子,然后能够在某处引用那个"主人",但我不知道这是怎么回事完成了.
我正在尝试在 WSL2 (Ubuntu 20.04) 上为 Azure 开发安装 Ansible,但在尝试安装时看到以下输出:
> pip3 install 'ansible[azure]'
Looking in indexes
Processing /home/ross/.cache/pip/wheels/73/11/5d/0fd1ddb1a82c6afefa3f475b62f3f35c9224aef05a37d330ed/ansible-2.10.3-py3-none-any.whl
WARNING: ansible 2.10.3 does not provide the extra 'azure'
Requirement already satisfied: ansible-base<2.11,>=2.10.3 in /home/ross/.local/lib/python3.8/site-packages (from ansible[azure]) (2.10.3)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (5.3.1)
Requirement already satisfied: jinja2 in /usr/lib/python3/dist-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (2.10.1)
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (2.8)
Requirement already satisfied: packaging in /home/ross/.local/lib/python3.8/site-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (20.4)
Requirement already satisfied: pyparsing>=2.0.2 in /home/ross/.local/lib/python3.8/site-packages (from packaging->ansible-base<2.11,>=2.10.3->ansible[azure]) (2.4.7) …Run Code Online (Sandbox Code Playgroud)