2014-10-24 1 views
-1

배포 팀은 Maven 사이트를 전쟁으로 패키지화하고 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> 
+0

누군가 -1. 왜 -1일까요? 의견을 부탁합니다. – angelcervera

답변

1

먼저 당신은 더 나은이 같은 부모를 가지고있다 ... 당신은 하위 폴더에 부모를 의미 잘못된 프로젝트 구조를 가지고있다.

+-- parent (pom.xml) 
     +--- child1 (pom.xml) 
     +--- child2 (pom.xml) 
     .... 

이것은 당신이 모듈 ../을 제공 할 필요가 없습니다 ... 그리고 차일 당신이 부모의 relativepath를 요소를 제공 할 필요가 없습니다 부모를 단순화합니다.

부모에서 maven-assembly-plugin을 정의하는 것 외에는 부모가 먼저 실행되므로 그 시점에 사이트를 생성하지 않았기 때문에 의미가 없습니다.

이 기본 솔루션은 별도의 아이

+-- parent (pom.xml) 
     +--- child1 (pom.xml) 
     +--- child2 (pom.xml) 
     +--- site-child (pom.xml) 

당신했고,매우 중요 당신이 포함하고자하는 자신의 사이트의 차일에 대한 종속성을 정의로 받는다는 - 조립 플러그인을 정의를 만드는 것입니다 . 사이트 위의 모든에서

을 사용하여 생성됩니다 : 당신이 기본 생활에서 사이트 수명주기에서의 전쟁을 packagage하지 할 필요가 의미 사이트 수명주기에 의미

mvn site 

<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> 

을 다음과 : 사이클 OS는이에서 받는다는 - 조립 플러그인 구성을 변경해야

<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>site</phase> 
        <goals> 
         <goal>single</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

다음을 통해이를 생성 할 수 있습니다.

mvn site