2

I added the following plugin in my child POM and its working correctly. If i add the same plugin in my parent POM its not working and i want this to be added in my parent POM and inherit this in my child POM.

Can you please help how to do that?

<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>
sea
  • 113
  • 8

1 Answers1

1

As far as I know you will need to configure the dependency at the <build><plugins><plugin> level for each pom that you require it in.

The closest thing I know of that lets you inherit information from a parent pom is through use of variables or by using <dependencyManagement>. But I don't think either really apply to what you are asking.

Note that <dependencyManagement> only manages dependency information, such as version, across you entire project. It does not actually create the dependencies unless explicitly defined again later under your <dependencies> section. You can refer the the maven documentation for more info.

user1231232141214124
  • 1,339
  • 3
  • 16
  • 22