2

子POMに次のプラグインを追加しましたが、正しく機能しています。親POMに同じプラグインを追加すると機能しません。これを親POMに追加し、これを子POMに継承します。

その方法を教えてください。

<plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.6</source>
              <target>1.6</target>
              <compilerArguments>                   <endorseddirs>${project.build.directory}/endorsed</endorseddirs>
              </compilerArguments>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.3</version>
            <executions>
              <execution>
                <phase>validate</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
                  <silent>true</silent>
                  <artifactItems>
                    <artifactItem>
                      <groupId>javax.xml.bind</groupId>
                      <artifactId>jaxb-api</artifactId>
                      <version>2.2.4</version>
                      <type>jar</type>
                    </artifactItem>
                    <artifactItem>
                      <groupId>javax.xml.ws</groupId>
                      <artifactId>jaxws-api</artifactId>
                      <version>2.2.8</version>
                      <type>jar</type>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
4

1 に答える 1

1

私の知る限り、依存関係を必要とする<build><plugins><plugin>各 pom のレベルで依存関係を構成する必要があります。

親 pom から情報を継承できるようにする最も近い方法は、変数を使用するか、<dependencyManagement>. しかし、どちらもあなたが求めていることに本当に当てはまるとは思いません。

<dependencyManagement>プロジェクト全体で、バージョンなどの依存情報のみを管理することに注意してください。<dependencies>後でセクションの下で明示的に再度定義しない限り、実際には依存関係を作成しません。詳細については、 Maven のドキュメントを参照してください。

于 2013-07-24T16:46:05.687 に答える