如果Maven Plugin在profile里面,就会被执行。

我正在使用插件 "copy-rename-maven-plugin",如果在配置文件内,它只是被执行,如果我试图在配置文件外使用它,它只是没有被 "检测到",我使用-X选项确认在配置文件外的插件没有被检测到,在 "Build Plan "期间不会作为GOAL显示。

我的pom.xml的代码 在配置文件里面。

<profile>
        <id>QUA</id>
         <properties>
            <db.jndi.path>java:comp/env/jdbc/QUA</db.jndi.path>
            <log4j.appender>${log4commonappender}</log4j.appender>
            <datasourceDD>QUA</datasourceDD>
            <excludeserviceprofile></excludeserviceprofile>
         </properties>
         <build>
            <plugins>
                <plugin>
                    <groupId>com.coderplus.maven.plugins</groupId>
                    <artifactId>copy-rename-maven-plugin</artifactId>
                    <version>1.0.1</version>
                    <executions>
                      <execution>
                        <id>rename-file</id>
                        <phase>compile</phase>
                        <goals>
                          <goal>rename</goal>
                        </goals>
                        <configuration>
                          <sourceFile>${project.build.outputDirectory}/services-profile.xml</sourceFile>
                          <destinationFile>${project.build.outputDirectory}/services.xml</destinationFile>
                        </configuration>
                      </execution>
                    </executions>
                </plugin>
            </plugins>
           </build>
    </profile>

外轮廓

<build>
    <finalName>app1</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
            <groupId>com.coderplus.maven.plugins</groupId>
            <artifactId>copy-rename-maven-plugin</artifactId>
            <version>1.0</version>
            <executions>
              <execution>
                <id>rename-file</id>
                <phase>compile</phase>
                <goals>
                  <goal>rename</goal>
                </goals>
                <configuration>
                  <sourceFile>${project.build.outputDirectory}/services.xml</sourceFile>
                  <destinationFile>${project.build.outputDirectory}/services.xml</destinationFile>
                </configuration>
              </execution>
            </executions>
        </plugin>

我怎么做才能在配置文件外使用这个插件?

先谢谢你。

0
投票

该插件必须在插件管理之外执行