Java Eclipse运行配置-单个配置中的多个运行配置?
我的项目MAIN包含子项目a和子项目B,并且每当我更改子项目a和子项目B时 我必须为子项目A和子项目B进行maven清理和maven安装 然后更新主项目 有没有办法在单一配置中实现这一切 比如: 项目的配置包括: 清洁,建造A,清洁,建造B,清洁,建造主项目Java Eclipse运行配置-单个配置中的多个运行配置?,java,eclipse,maven,Java,Eclipse,Maven,我的项目MAIN包含子项目a和子项目B,并且每当我更改子项目a和子项目B时 我必须为子项目A和子项目B进行maven清理和maven安装 然后更新主项目 有没有办法在单一配置中实现这一切 比如: 项目的配置包括: 清洁,建造A,清洁,建造B,清洁,建造主项目 感谢您这么做,我在顶级家长POM中声明了一个配置文件,如下所示 <profile> <id>build-all</id>
感谢您这么做,我在顶级家长POM中声明了一个配置文件,如下所示
<profile>
<id>build-all</id>
<modules>
<module>MAIN</module>
<module>SubProjectA</module>
<module>SubProjectB</module>
</modules>
</profile>
构建所有
主要
子项目
子项目B
在eclipse运行配置中,使用父POM路径作为基本目录,“buildall”作为概要文件
请记住,必须将父POM声明为其他POM的父POM
有没有办法在单一配置中实现这一切
你当然可以。这是maven多模块项目的框架:
父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>my.group</groupId>
<artifactId>myProject</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>myProject</name>
<url>http://maven.apache.org</url>
<modules>
<module>moduleA</module>
<module>moduleB</module>
</modules>
<build>
....
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
....
</dependencies>
</dependencyManagement>
<dependencies>
....
</dependencies>
</project>
4.0.0
我的团队
。目前,没有太大帮助,并且有一个断开的链接。谢谢,您能给我一些参考资料吗,我可以在哪里阅读有关Super pom的内容,以及我们为什么需要它。单用谷歌搜索是没有帮助的,我应该说“父POM”而不是“超级POM”,如果我想在多个父POM中包含moduleA呢?那样的话我怎么申报?@Roxy-hmmm。。。我不确定纯maven是否能做到这一点。我还要说,在多个多模块项目中使用一个模块违反了这个概念。如果一个模块在不同的项目中具有普遍意义,那么它在这些项目中就是一个依赖项。你是对的。这是依赖,可能我还没有清除我自己。当我对这些依赖项进行一些更改时,我需要首先构建这些依赖项,然后构建主项目,因此,我想以某种方式克服构建第一个依赖项的问题。@Roxy也许在eclipse中,您可以在构建多模块项目之前,在模块a上创建一个始终调用mvn clean install
的构建配置。此外,了解您不仅可以在多模块项目中使用父POM的conecpt,而且还可以在独立的工件中使用它可能会有所帮助。
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>myProject</artifactId>
<groupId>my.group</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>moduleA<artifactId>
<name>moduleA</name>
<packaging>jar</packaging> <!-- this is default -->
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<!-- no version here, see dependencyManagemant in parent POM -->
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<!-- no version here, see dependencyManagemant in parent POM --> <scope>test</scope>
</dependency>
</dependencies>
</project>
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>nbaWorker</artifactId>
<groupId>de.lgn.aaabk</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>moduleB</artifactId>
<name>moduleB</name>
<packaging>jar</packaging> <!-- this is default -->
<dependencies>
<dependency>
<groupId>my.group</groupId>
<artifactId>moduleA</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<!-- no version here, see dependencyManagemant in parent POM -->
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<!-- no version here, see dependencyManagemant in parent POM --> <scope>test</scope>
</dependency>
</dependencies>
</project>