【发布时间】:2018-01-12 18:05:01
【问题描述】:
我正在为一个看起来像这样的多模块项目使用 maven 程序集
PARENT\pom.xml
--warModule
-- pom.xml
--/target/module-1.war
--configModule
--pom.xml
--target/**module-2.jar**
--distrib
--pom.xml
--src/assembly/assembly.xml
在我的分发模块中,我想打包并创建一个 jar 文件,该文件应该只包含 module-1.war 和 module-2.jar 文件。 p>
我的 distrib/pom.xml 看起来像这样
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.wellsfargo.gateway.fx</groupId>
<artifactId>distrib</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>distrib</artifactId>
<properties>
<izpack.version>5.1.2</izpack.version>
<izpack.base.dir>${project.build.directory}\${project.artifactId}-${project.version}-fx\izpack</izpack.base.dir>
<izpack.standalone.compiler.version>4.3.2</izpack.standalone.compiler.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptors>
<descriptor>distrib/src/assembly/assembly.xml
</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
我的 assembly.xml 看起来像这样 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> izpack ${main.basedir} 目录 假的
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>propdeploy</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>../warModule/target/module-1.war</source>
<destName>foreign-exchange-v2.war</destName>
<outputDirectory>wardeploy</outputDirectory>
</file>
<file>
<source>../configModule/target/module-2.jar</source>
<destName>module-2.jar</destName>
<outputDirectory>wardeploy</outputDirectory>
</file>
</files>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<useProjectArtifact>true</useProjectArtifact>
</dependencySet>
</dependencySets>
问题是当前没有识别分发的父目录并抱怨 noSuchFileFound 在位置 xxxx/distrib/warModule/target/module-v1.war 和 module-v2 相同。战争。如何获取父文件夹子路径中的文件?
有什么想法吗?
【问题讨论】:
-
在我看来,您的父 POM 和子 POM 都具有相同的 artifactID:
<artifactId>distrib</artifactId>。这是故意的吗? -
你是如何构建项目的?例如,您使用的是
mvn clean install?对于您的运行配置,您的基本目录是什么?是父项目还是 Distro 文件夹? -
感谢您的指点。家长 ID 是问题