maven项目具有以下结构,以下添加了“父POM”->“子POM”->“ GrandChild” POM。当我mvn clean install从GrandChild POM运行时,在与GrandChild POM(父/子/目标)相同的路径上生成目标文件夹,并且来自Module1,Module2和Module3的所有jar文件都填充在此目录下。当我mvn package从父级运行时,将在父目录中创建目标文件夹,并且所有jar都如上放置在该文件夹中。但是,如果我mvn clean install从父POM运行,则项目内不会生成任何目标文件夹或jar。而是将所有jar都上传到本地.m2存储库。当我mvn clean install从父POM运行时,我需要在项目内的目标文件夹(可能在大子目录:parent / child / target)内生成jar文件。我怎样才能做到这一点?父POM:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>parentGroup</groupId> <artifactId>parentArtifact</artifactId> <version>3.3</version> <packaging>pom</packaging> <modules> <module>ChildModule</module> </modules></project>子POM:<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>childGroup</groupId> <artifactId>childArtifact</artifactId> <packaging>pom</packaging> <version>1.0.0</version> <name>A Camel Spring Route</name> <url>http://www.myorganization.org</url> <modules> <module>GrandChildModule</module> </modules></project>孙子POM:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>grandChildGroup</groupId> <artifactId>grandChildArtifact</artifactId> <version>1.0.0</version> <packaging>pom</packaging>
添加回答
举报
0/150
提交
取消