我们有几个遗留Java项目,这是我们转变为行项目/模块。 以前,所有项目//需要将物品寄项目并没有真正的依赖关系的管理。 外部的依赖性上存在的公司网络驱动器以及直接包括为瓶中的内容项目的各个模块。 内部依赖性的、简单的项目参考使用。 这是一个痛苦构建的一切,因为该程序必须建立的一切正确的顺序。
现在,我们的位置,我们可以打开所有的家模块在IDEA和演讲视频。 然而,我遇到麻烦找出最佳的方式,结合不同的模块和外部的依赖在一个特定的方式,符合内部插件状结构。 特别是随//需要将物品寄(发展与IDEs必须是可能的)。
这里是如何从初的储存库/项目的结构大致看起来像。 该文件夹结构的模块是默认的专家的结构为每个模块。 所列特性这个网站是太笨拙了,所以我把它作为截图...
我们有一个内部专家库的材料和建筑专家等等。 是的工作。 为IDEA,我可以运行调试的终端产品对customer1通过一个定制的运行配置,其副本必要的文件所需的结构:
与IDEA,我可以试的软件,但我认为,这种办法(定义用浏览器运行配置我创造的,指的所有需要的罐子和文件直接)是很丑陋的,并且象偷我找不到一个类似的"运行配置"的机制。
所以我试图实现这种构建进程,通过创建一个新的"Customer1Runnable"家的项目作为一种建立的描述,这点向所有需要的家模块。 在此基础上,我相信我可以实现的和全自动创造所需的软件结构。 因此复制所有模块成为一个插件,文件夹和所有依赖性的模块进入一个lib文件夹内Customer1Runnable项目,利用专家组-插件。
首先,是我的假设正确,这是一个可能的使用情况的专家组-插件?
该项目本身不具有任何源文件,它是唯一一个pom.xml 和assembly-config.xml 描述符。 我附上会插件包阶段。 当跑的 mvn package
命令所有连接的模块建造的,但是为执行大会的插件,我得到以下产出:
对于初学者来说,我只是试图包括一个模块组装的描述符。 这是XML(opicom-assembly.xml):
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<id>opicom-assembly</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>my.company.reporting:module1</include>
</includes>
</moduleSet>
</moduleSets>
</assembly>
pom.xml 的项目Customer1Runnable
<?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>
<version>1.6</version>
<groupId>my.company.customer1</groupId>
<artifactId>OpicomRunnable</artifactId>
<packaging>pom</packaging>
<name>OpicomRunnable</name>
<repositories>
<repository>
<id>Company-Maven-Repo</id>
<url>file:\\\\MyCompany\TFSDrop\MavenRepo</url>
</repository>
</repositories>
<modules>
<module>../my.company.customer1.module1</module>
<module>../my.company.customer1.module2</module>
.
.
.
<module>../../MyCompany_Common/Report/my.company.reporting.module1</module>
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<inherited>true</inherited>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>opicom-assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
</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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>my.company</groupId>
<artifactId>reporting</artifactId>
<version>1.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>module1</artifactId>
<version>1.3</version>
<packaging>jar</packaging>
<dependencies>
<!-- external dependencies -->
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>21.1.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<finalName>my-company-${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>../build</outputDirectory>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
</project>
谢谢你的任何输入关于什么我做错了这里如何实现这种与家.
编辑: 作为请求,这里的一个例子项目作为拉链文件。 https://drive.google.com/drive/folders/1ilJeTrOPgYgUTdOP0J4BQcBnPT5fls0k?usp=sharing 父目录ModuleGroupCustomer和ModuleGroupCommon做的代表git仓库中的现实情况。 相对模块的路径造成的,因为家项目,该项目应该是我的"运行配置"指向家项目在这两个仓库。
也许我误会专家在一般? 我认为它在使用条款的情况下对于依赖管理类似。净nuget包,但也作为"项目的构成"普通//需要将物品寄/架构来达成这项目。
它是更好地简单地坚持现有的//需要将物品寄项目的日常发展?