【发布时间】:2014-10-24 18:34:19
【问题描述】:
部署团队要求我们将我们的 maven 站点打包为一个 war,并将其发布到 Archiva 存储库中。
我们的第一个问题,如何组装战争,里面有子站点。
我试试这个,但它不起作用。 产生的战争不包括儿童网站。 我在 maven 文档、google、stackoverflow 等方面进行了研究。但我没有找到任何东西。
项目结构文件夹:
.
├── child-yyyy-1
│ ├── pom.xml
│ └── src
│ ├── main
│ │ └── java
│ │ └── com
│ │ └── xxx
│ │ └── App.java
│ └── test
│ └── java
├── child-yyyy-2
│ ├── pom.xml
│ └── src
│ ├── main
│ │ └── java
│ │ └── com
│ │ └── xxx
│ │ └── App.java
│ └── test
│ └── java
└── parent-site
├── assembly
│ └── api-site.xml
└── pom.xml
父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>
<groupId>com.xxx</groupId>
<artifactId>parent-yyyy</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parent-yyyy</name>
<modules>
<module>../child-yyyy-1</module>
<module>../child-yyyy-2</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>assembly/api-site.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
api-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>api-site</id>
<formats>
<format>war</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>target/site</directory>
</fileSet>
<fileSet>
<outputDirectory>/child-yyyy-1/</outputDirectory>
<directory>child-yyyy-1/target/site</directory>
</fileSet>
<fileSet>
<outputDirectory>/child-yyyy-2/</outputDirectory>
<directory>child-yyyy-2/target/site</directory>
</fileSet>
</fileSets>
</assembly>
孩子 1 个 pom:
<?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.xxx</groupId>
<artifactId>parent-yyyy</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../site</relativePath>
</parent>
<groupId>com.xxx</groupId>
<artifactId>child-yyyy-1</artifactId>
<version>1.0-SNAPSHOT</version>
<name>child-yyyy-1</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
孩子 2 pom:
<?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.xxx</groupId>
<artifactId>parent-yyyy</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../site</relativePath>
</parent>
<groupId>com.xxx</groupId>
<artifactId>child-yyyy-2</artifactId>
<version>1.0-SNAPSHOT</version>
<name>child-yyyy-2</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
【问题讨论】:
-
某人-1。为什么是-1?请发表评论。
标签: maven maven-3 maven-assembly-plugin