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

时间:2016-09-08 11:09:09

标签: maven wso2 wso2esb

我正在尝试创建一个包含许多代理服务,序列等的Maven多模块项目。当我创建artifact.xml文件时,将它放在与我的pom.xml相同的控制器中。我收到以下错误。

[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

&#13;
&#13;
<?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>
&#13;
&#13;
&#13;

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

2 个答案:

答案 0 :(得分:1)

我知道这是一个老问题,但我在我的一个项目中遇到了类似的问题。我遇到了一个不同的解决方案,我会在这里分享它,以防将来可能对任何人有所帮助。
在我的情况下,我注意到我的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>
...

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

答案 1 :(得分:0)

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