1

私は、もともとEclipseとantに依存してビルドする古いプロジェクトをmavenに変換しています。そのプロジェクトのディレクトリ レイアウトを変更できないと述べたので、その ant スクリプトでビルドしたものと同様のアーティファクトを生成したいと考えています。元のプロジェクトは、サブプロジェクトからのすべてのクラスをEclipseを使用して1つのディレクトリに構築し、結果のクラスをantを使用してサブパッケージにパッケージ化します(サブプロジェクトとは異なります)。

この要件に対処するために、次の構造を作成しました: (現在はサブパッケージの 1 つだけです)

warp-parent
|
|- pom.xml
|- warp-client
|  |
|  | - pom.xml

親ポンは次のとおりです。

<?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>it.sinesy.warp</groupId>
<artifactId>warp-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>warp-parent</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.8</version>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                         <sources>
                             <source>../../src</source>
                             <source>../../srcj2ee</source>
                             <source>../../srcjsf</source>
                             <source>../../srcrest</source>
                             <source>../../srcswing</source>
                             <source>../../srctest</source>
                             <source>../../srcweb</source>
                             <source>../../srcws</source>
                         </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
</dependencies>

<modules>
    <module>warp-client</module>
</modules>
</project>

そして子のもの:

<?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>it.sinesy.warp</groupId>
    <artifactId>warp-parent</artifactId>
    <version>1.0-SNAPSHOT</version>
</parent>

<groupId>it.sinesy.warp</groupId>
<artifactId>warp-client</artifactId>
<version>1.0-SNAPSHOT</version>
<name>warp-client</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
    <plugins>
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-compiler-plugin</artifactId>
             <version>3.1</version>
             <configuration>
                 <includes>
                     <include>**</include>
                     <!--
                     <include>**/it/tinet/warp/swing/**/java/*</include>
                     <include>**/it/tinet/warp/common/**/java/*</include>
                     <include>**/it/tinet/warp/swing/**/client/*</include> -->
                 </includes>
             </configuration>
         </plugin>
    </plugins>
</build>

<dependencies>
</dependencies>
</project>

親pomをコンパイルするためにコンパイルしようとすると、ソースがコンパイルされていない次の出力が得られました。

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] warp-parent
[INFO] warp-client
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building warp-parent 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ warp-parent ---
[INFO] Source directory: /home/elettronik/test/warp/warp_src/src added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/srcj2ee added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/srcjsf added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/srcrest added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/srcswing added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/srctest added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/srcweb added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/srcws added.
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building warp-client 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ warp-client ---
[INFO] Source directory: /home/elettronik/test/warp/warp_src/mvn/src added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/mvn/srcj2ee added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/mvn/srcjsf added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/mvn/srcrest added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/mvn/srcswing added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/mvn/srctest added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/mvn/srcweb added.
[INFO] Source directory: /home/elettronik/test/warp/warp_src/mvn/srcws added.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ warp-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/elettronik/test/warp/warp_src/mvn/warp-parent/warp-client/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ warp-client ---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] warp-parent ....................................... SUCCESS [0.762s]
[INFO] warp-client ....................................... SUCCESS [1.389s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.389s
[INFO] Finished at: Fri Aug 16 14:03:32 CEST 2013
[INFO] Final Memory: 6M/109M
[INFO] ------------------------------------------------------------------------

誰かがこれを機能させるためのアドバイスをいただけますか? ありがとうございます。

4

1 に答える 1

1

親pomが表示<packaging>pom</packaging>されるため、親pomで定義したソースはコンパイルされません。

于 2013-08-16T12:10:01.217 に答える