user2254180
user2254180

Reputation: 856

Error when including artifact.xml in WSO2 ESB project

I am trying to create a Maven multi-module project that will include a number of proxy services, sequences, etc. When I create the artifact.xml file, place it in the same director as my pom.xml. I get the following error.

[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]

This is the artifact.xml file I have.

<?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>

This is my 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>

Before anyone asks, yes I am absolutely certain I am invoking mvn install in the correct directory. mvn install works fine until I place artifact.xml in the same directory.

Upvotes: 1

Views: 2311

Answers (2)

Rodrigo Vasconcelos
Rodrigo Vasconcelos

Reputation: 1290

I know it's an old question, but I encountered a similar problem in a project of mine.I encountered a different solution, and I'll share it here in the case it may help anyone in the future.
In my case, I noticed that the pom file for one of the child projects of my maven multi module project was missing a couple plugins:

...
<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>
...

After I added those plugins, the build was successful.

Upvotes: 1

user2254180
user2254180

Reputation: 856

I figured out this issue. The problem I was having was being caused by copying message-processor's and sequences from other projects, dropping them into the relevant folder, then manually adding new entries into artifact.xml. For whatever reason, the WSO2 build process didn't like this. The solution was to create my sequences, etc. from within WSO2, then pasting over the default source code with my own code.

Upvotes: 0

Related Questions