在 WSO2 ESB 项目中包含 artifact.xml 时出错

Error when including artifact.xml in WSO2 ESB project

我正在尝试创建一个 Maven 多模块项目,它将包括许多代理服务、序列等。当我创建 artifact.xml 文件时,将它放在与我的 [=] 相同的目录中29=]。我收到以下错误。

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\myproject\target\capp). Please verify you invoked Maven from the correct directory. -> [Help 1]

这是我的 artifact.xml 文件。

<?xml version="1.0" encoding="UTF-8"?><artifacts>
<artifact name="testTextMessage" groupId="com.example.ReadTest.message-processors" version="1.0.0" type="synapse/message-processors" serverRole="EnterpriseServiceBus">
    <file>src/main/synapse-config/message-processors/testTextMessage.xml</file>
</artifact>

这是我的 pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>
  <groupId>com.example.ReadTest</groupId>
  <artifactId>ReadTest</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>
  <name>ReadTest</name>
  <description>ReadTest</description>
  <properties>
    <maven.test.skip>false</maven.test.skip>
    <CApp.type>bpel/workflow=zip,lib/registry/filter=jar,webapp/jaxws=war,lib/library/bundle=jar,service/dataservice=dbs,synapse/local-entry=xml,synapse/proxy-service=xml,carbon/application=car,registry/resource=zip,lib/dataservice/validator=jar,synapse/endpoint=xml,web/application=war,lib/carbon/ui=jar,service/axis2=aar,synapse/sequence=xml,synapse/configuration=xml,wso2/gadget=dar,lib/registry/handlers=jar,lib/synapse/mediator=jar,synapse/task=xml,synapse/api=xml,synapse/template=xml,synapse/message-store=xml,synapse/message-processors=xml,synapse/inbound-endpoint=xml</CApp.type>
  </properties>
  <repositories>
    <repository>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </releases>
      <id>wso2-nexus</id>
      <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </releases>
      <id>wso2-nexus</id>
      <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <directory>target/capp</directory>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.4.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>
              </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>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>mvn</executable>
              <workingDirectory>${project.build.directory}</workingDirectory>
              <arguments>
                <argument>deploy</argument>
                <argument>-Dmaven.test.skip=${maven.test.skip}</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
        <configuration />
      </plugin>
      <plugin>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <buildcommands />
          <projectnatures>
            <projectnature>org.wso2.developerstudio.eclipse.esb.project.nature</projectnature>
          </projectnatures>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.wso2.maven</groupId>
        <artifactId>wso2-esb-messageprocessor-plugin</artifactId>
        <version>1.1.0</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>task</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>
</project>

在任何人问之前,是的,我绝对确定我在正确的目录中调用 mvn install。 mvn install 工作正常,直到我将 artifact.xml 放在同一目录中。

我想通了这个问题。我遇到的问题是由从其他项目复制消息处理器和序列,将它们放入相关文件夹,然后手动将新条目添加到 artifact.xml 引起的。无论出于何种原因,WSO2 构建过程都不喜欢这样。解决方案是从 WSO2 中创建我的序列等,然后用我自己的代码粘贴默认源代码。

我知道这是一个老问题,但是我在mine.I的项目中遇到了类似的问题,遇到了不同的解决方案,我会在这里分享它,以防将来对任何人有所帮助。
就我而言,我注意到我的 maven 多模块项目的一个子项目的 pom 文件缺少几个插件:

...
<plugin>
 <groupId>org.wso2.maven</groupId>
 <artifactId>wso2-esb-proxy-plugin</artifactId>
 <version>2.1.0</version>
 <extensions>true</extensions>
 <executions>
   <execution>
     <id>proxy</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-template-plugin</artifactId>
  <version>2.1.0</version>
  <extensions>true</extensions>
  <executions>
    <execution>
      <id>template</id>
      <phase>process-resources</phase>
      <goals>
        <goal>pom-gen</goal>
      </goals>
      <configuration>
        <artifactLocation>.</artifactLocation>
        <typeList>${artifact.types}</typeList>
      </configuration>
    </execution>
  </executions>
  <configuration />
</plugin>
...

添加这些插件后,构建成功。