如何将一堆工件从文件夹部署到本地存储库usgin Build Helper MavenPlugin?

时间:2018-06-14 09:05:01

标签: maven wso2 wso2esb

我有一个WSO2资源项目,其中包含以下树:

.
├── artifact.xml
├── pom.xml
└── src
    └── main
        └── synapse-config
            └── api
                ├── Proyect.API1.xml
                └── Proyect.API2.xml

从原型来看,pom.xml如下所示:

<build>
  <directory>target/capp</directory>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <version>1.6.0</version>
      <extensions>true</extensions>
      <executions>
        <execution>
          <id>package</id>
          <phase>package</phase>
          <goals>
            <goal>exec</goal>
          </goals>
          <configuration>
            <executable>mvn</executable>
            <workingDirectory>${project.build.directory}</workingDirectory>
            <arguments>
              <argument>clean</argument>
              <argument>package</argument>
              <argument>-Dmaven.test.skip=${maven.test.skip}</argument>
              <argument>-Dmaven.repo.local=${maven.repo.local}</argument>
            </arguments>
          </configuration>
        </execution>
        <execution>
          <id>install</id>
          <phase>install</phase>
          <goals>
            <goal>exec</goal>
          </goals>
          <configuration>
            <executable>mvn</executable>
            <workingDirectory>${project.build.directory}</workingDirectory>
            <arguments>
              <argument>clean</argument>
              <argument>install</argument>
              <argument>-Dmaven.test.skip=${maven.test.skip}</argument>
              <argument>-Dmaven.repo.local=${maven.repo.local}</argument>
            </arguments>
          </configuration>
        </execution>
      </executions>
      <configuration />
    </plugin>
    <plugin>
      <groupId>org.wso2.maven</groupId>
      <artifactId>wso2-esb-synapse-plugin</artifactId>
      <version>2.1.0</version>
      <extensions>true</extensions>
      <executions>
        <execution>
          <id>synapse</id>
          <phase>process-resources</phase>
          <goals>
            <goal>pom-gen</goal>
          </goals>
          <configuration>
            <artifactLocation>.</artifactLocation>
            <typeList>${artifact.types}</typeList>
          </configuration>
        </execution>
      </executions>
      <configuration />
    </plugin>
    <plugin>
      <groupId>org.wso2.maven</groupId>
      <artifactId>wso2-esb-api-plugin</artifactId>
      <version>2.1.0</version>
      <extensions>true</extensions>
      <executions>
        <execution>
          <id>api</id>
          <phase>process-resources</phase>
          <goals>
            <goal>pom-gen</goal>
          </goals>
          <configuration>
            <artifactLocation>.</artifactLocation>
            <typeList>${artifact.types}</typeList>
          </configuration>
        </execution>
      </executions>
      <configuration />
    </plugin>
  </plugins>
</build>

在这里,Maven使用Exec Maven插件将Maven执行到/target/capp。我想避免使用Build Helper Maven插件来上传./src/main/synapse-config/api/下的所有工件,如此名称格式:Proyect.API1-0.1.0-SNAPSHOT.xml(或{artifactName}-{pom.version}-{extension})。

我厌倦了,但它不起作用:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>3.0.0</version>
    <executions>
        <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
                <goal>attach-artifact</goal>
            </goals>
            <configuration>
                <artifacts>
                    <artifact>
                        <file>${basedir}\src\main\synapse-config\api\*</file>
                        <type>xml</type>
                    </artifact>
                </artifacts>
            </configuration>
        </execution>
    </executions>
</plugin>

是否可以将此插件用于此目的?

0 个答案:

没有答案