Issue
I am trying to run an imported Application in Anypoint Studio which works with a SAP connector, but it fails right after starting, it seems to be related to the pom.xml file, as additional info I've been told that this project has been migrated from Mule 3 to Mule 4. I get the following Output:
`
[INFO] Scanning for projects... Downloading from jfrog: http://repo.jfrog.org/artifactory/plugins-releases-local/org/jfrog/maven/annomojo/maven-plugin-tools-anno/1.4.0/maven-plugin-tools-anno-1.4.0.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: net.inspira.api:api-transformers:jar -> duplicate declaration of version 2.0.0 @ line 624, column 14
[ERROR] Unresolveable build extension: Plugin org.mule.tools.maven:mule-app-maven-plugin:1.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.mule.tools.maven:mule-app-maven-plugin:jar:1.1 -> org.jfrog.maven.annomojo:maven-plugin-tools-anno:jar:1.4.0 @
[ERROR] Unknown packaging: mule @ line 8, column 13 @
[ERROR] The build could not read 1 project -> [Help 1][ERROR]
[ERROR] The project com.mycompany:sap-api-supply:3.2.0 (/home/byranernesto/AnypointStudio/studio-workspace/Mule sap-api-supply-new Application/pom.xml) has 2 errors [ERROR] Unresolveable build extension: Plugin org.mule.tools.maven:mule-app-maven-plugin:1.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.mule.tools.maven:mule-app-maven-plugin:jar:1.1 -> org.jfrog.maven.annomojo:maven-plugin-tools-anno:jar:1.4.0: Failed to read artifact descriptor for org.jfrog.maven.annomojo:maven-plugin-tools-anno:jar:1.4.0: Could not transfer artifact org.jfrog.maven.annomojo:maven-plugin-tools-anno:pom:1.4.0 from/to jfrog (http://repo.jfrog.org/artifactory/plugins-releases-local): transfer failed for http://repo.jfrog.org/artifactory/plugins-releases-local/org/jfrog/maven/annomojo/maven-plugin-tools-anno/1.4.0/maven-plugin-tools-anno-1.4.0.pom, status: 503 Service Unavailable: Back-end server is at capacity: Server returned HTTP response code: 503 for URL: http://repo.jfrog.org/artifactory/plugins-releases-local/org/jfrog/maven/annomojo/maven-plugin-tools-anno/1.4.0/maven-plugin-tools-anno-1.4.0.pom -> [Help 2]
[ERROR] Unknown packaging: mule @ line 8, column 13 [ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginManagerException
`
My pom.xml file:
`
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>sap-api-supply</artifactId>
<version>3.2.0</version>
<packaging>mule</packaging>
<name>Mule sap-api-supply Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mule.version>3.9.5</mule.version>
<mule.tools.version>1.1</mule.tools.version>
<mule-transport-sap.version>3.0.0</mule-transport-sap.version>
<sapjco.version>3.0.14</sapjco.version>
<sapidoc.version>3.0.12</sapidoc.version>
<lib.directory>${project.build.directory}/lib</lib.directory>
<native.lib.directory>${lib.directory}/${envClassifier}</native.lib.directory>
</properties>
<profiles>
<profile>
<id>dos-i386</id>
<activation>
<os>
<family>windows</family>
<arch>i386</arch>
</os>
</activation>
<properties>
<envClassifier>ntintel</envClassifier>
<envType>dll</envType>
<native.lib.filename>sapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>windows-i386</id>
<activation>
<os>
<family>windows</family>
<arch>i386</arch>
</os>
</activation>
<properties>
<envClassifier>ntintel</envClassifier>
<envType>dll</envType>
<native.lib.filename>sapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>dos-x86</id>
<activation>
<os>
<family>dos</family>
<arch>x86</arch>
</os>
</activation>
<properties>
<envClassifier>ntintel</envClassifier>
<envType>dll</envType>
<native.lib.filename>sapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>windows-x86</id>
<activation>
<os>
<family>windows</family>
<arch>x86</arch>
</os>
</activation>
<properties>
<envClassifier>ntintel</envClassifier>
<envType>dll</envType>
<native.lib.filename>sapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>dos-x86_64</id>
<activation>
<os>
<family>dos</family>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<envClassifier>ntamd64</envClassifier>
<envType>dll</envType>
<native.lib.filename>sapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>windows-x86_64</id>
<activation>
<os>
<family>windows</family>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<envClassifier>ntamd64</envClassifier>
<envType>dll</envType>
<native.lib.filename>sapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>dos-amd64</id>
<activation>
<os>
<family>dos</family>
<arch>amd64</arch>
</os>
</activation>
<properties>
<envClassifier>ntamd64</envClassifier>
<envType>dll</envType>
<native.lib.filename>sapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>windows-amd64</id>
<activation>
<os>
<family>windows</family>
<arch>amd64</arch>
</os>
</activation>
<properties>
<envClassifier>ntamd64</envClassifier>
<envType>dll</envType>
<native.lib.filename>sapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>linux-i386</id>
<activation>
<os>
<name>linux</name>
<arch>i386</arch>
</os>
</activation>
<properties>
<envClassifier>linuxintel</envClassifier>
<envType>so</envType>
<native.lib.filename>libsapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>linux-x86</id>
<activation>
<os>
<name>linux</name>
<arch>x86</arch>
</os>
</activation>
<properties>
<envClassifier>linuxintel</envClassifier>
<envType>so</envType>
<native.lib.filename>libsapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>linux-x86_64</id>
<activation>
<os>
<name>linux</name>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<envClassifier>linuxx86_64</envClassifier>
<envType>so</envType>
<native.lib.filename>libsapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>linux-amd64</id>
<activation>
<os>
<name>linux</name>
<arch>amd64</arch>
</os>
</activation>
<properties>
<envClassifier>linuxx86_64</envClassifier>
<envType>so</envType>
<native.lib.filename>libsapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>macosx-i386</id>
<activation>
<os>
<name>mac os x</name>
<arch>i386</arch>
</os>
</activation>
<properties>
<envClassifier>darwinintel</envClassifier>
<envType>jnilib</envType>
<native.lib.filename>libsapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>macosx-x86</id>
<activation>
<os>
<name>mac os x</name>
<arch>x86</arch>
</os>
</activation>
<properties>
<envClassifier>darwinintel</envClassifier>
<envType>jnilib</envType>
<native.lib.filename>libsapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>macosx-x86_64</id>
<activation>
<os>
<name>mac os x</name>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<envClassifier>darwinintel64</envClassifier>
<envType>jnilib</envType>
<native.lib.filename>libsapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>macosx-amd64</id>
<activation>
<os>
<name>mac os x</name>
<arch>amd64</arch>
</os>
</activation>
<properties>
<envClassifier>darwinintel64</envClassifier>
<envType>jnilib</envType>
<native.lib.filename>libsapjco3</native.lib.filename>
</properties>
</profile>
<profile>
<id>studio</id>
<activation>
<property>
<name>runtime</name>
<value>studio</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-native-lib-for-unit-tests</id>
<phase>process-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<stripVersion>true</stripVersion>
<outputDirectory>${native.lib.directory}</outputDirectory>
<artifactItems>
<!-- We use maven profiles to choose the native library according
to architecture and operating system -->
<artifactItem>
<groupId>com.sap.conn.jco</groupId>
<artifactId>sapjco3</artifactId>
<type>${envType}</type>
<classifier>${envClassifier}</classifier>
<overWrite>true</overWrite>
<destFileName>${native.lib.filename}.${envType}</destFileName>
</artifactItem>
<!-- If the target platform differ from your development platform,
you can add the native library uncommenting the following block Note that
you must set the following elements accordingly: type, classifier, outputDirectory
and destFileName -->
<artifactItem>
<groupId>com.sap.conn.jco</groupId>
<artifactId>sapjco3</artifactId>
<type>so</type>
<classifier>linuxx86_64</classifier>
<overWrite>true</overWrite>
<outputDirectory>${lib.directory}/linuxx86_64</outputDirectory>
<destFileName>libsapjco3.so</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-jco-libs-unit-tests</id>
<phase>process-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<stripVersion>true</stripVersion>
<outputDirectory>${lib.directory}</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>com.sap.conn.jco</groupId>
<artifactId>sapjco3</artifactId>
<overWrite>true</overWrite>
<destFileName>sapjco3.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>com.sap.conn.idoc</groupId>
<artifactId>sapidoc3</artifactId>
<overWrite>true</overWrite>
<destFileName>sapidoc3.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>com.mulesoft.muleesb.transports</groupId>
<artifactId>mule-transport-sap</artifactId>
<overWrite>true</overWrite>
<destFileName>mule-transport-sap-${mule-transport-sap.version}.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-sap-jars</id>
<phase>package</phase>
<configuration>
<target>
<zip destfile="${project.build.directory}/${project.build.finalName}.zip" update="true">
<zipfileset dir="${project.build.directory}/lib" prefix="lib"/>
</zip>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<sharedLibraries>
<sharedLibrary>
<groupId>net.inspira.api</groupId>
<artifactId>api-transformers</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</sharedLibrary>
</sharedLibraries>
<copyToAppsDirectory>true</copyToAppsDirectory>
<inclusions>
<inclusion>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-property-placeholder</artifactId>
</inclusion>
<inclusion>
<groupId>com.mulesoft.muleesb.transports</groupId>
<artifactId>mule-transport-sap</artifactId>
</inclusion>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-apikit-soap</artifactId>
</inclusion>
<!-- Cloud Areas -->
<inclusion>
<groupId>3284c114-3570-4feb-a444-7d90b56935a3</groupId>
<artifactId>basetis-sap-connector</artifactId>
</inclusion>
<!-- Cloud Areas -->
<!-- Cloud de Mule -->
<!-- <inclusion> -->
<!-- <groupId>org.mule.modules</groupId> -->
<!-- <artifactId>basetis-sap-connector</artifactId> -->
<!-- </inclusion> -->
<!-- Cloud de Mule -->
</inclusions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>project</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/app/</directory>
</resource>
<resource>
<directory>mappings/</directory>
</resource>
<resource>
<directory>src/main/api/</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Mule Dependencies -->
<dependencies>
<!-- Xml configuration -->
<dependency>
<groupId>com.mulesoft.muleesb</groupId>
<artifactId>mule-core-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Xml configuration -->
<dependency>
<groupId>com.mulesoft.muleesb.modules</groupId>
<artifactId>mule-module-spring-config-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mule Transports -->
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-file</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-http</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.muleesb.transports</groupId>
<artifactId>mule-transport-jdbc-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.muleesb.transports</groupId>
<artifactId>mule-transport-jms-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-vm</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mule Modules -->
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-scripting</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-xml</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- SAP Dependencies -->
<dependency>
<groupId>com.mulesoft.muleesb.transports</groupId>
<artifactId>mule-transport-sap</artifactId>
<version>${mule-transport-sap.version}</version>
</dependency>
<dependency>
<groupId>com.sap.conn.jco</groupId>
<artifactId>sapjco3</artifactId>
<version>${sapjco.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sap.conn.idoc</groupId>
<artifactId>sapidoc3</artifactId>
<version>${sapidoc.version}</version>
<scope>provided</scope>
</dependency>
<!-- for testing -->
<dependency>
<groupId>org.mule.tests</groupId>
<artifactId>mule-tests-functional</artifactId>
<version>${mule.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-apikit</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.weave</groupId>
<artifactId>mule-plugin-weave</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-spring-config</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-json</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.inspira.api</groupId>
<artifactId>api-internal-security</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>net.inspira.api</groupId>
<artifactId>api-transformers</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>net.inspira.api</groupId>
<artifactId>api-connection</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-property-placeholder</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-apikit-soap</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1.3</version>
</dependency>
<!-- Cloud Areas -->
<dependency>
<groupId>3284c114-3570-4feb-a444-7d90b56935a3</groupId>
<artifactId>basetis-sap-connector</artifactId>
<version>1.1.5</version>
</dependency>
<!-- Cloud Areas -->
<!-- Cloud Mule -->
<!-- <dependency> -->
<!-- <groupId>org.mule.modules</groupId> -->
<!-- <artifactId>basetis-sap-connector</artifactId> -->
<!-- <version>1.1.1</version> -->
<!-- </dependency> -->
<!-- Cloud Mule -->
<dependency>
<groupId>net.inspira.api</groupId>
<artifactId>api-transformers</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<repositories>
<!-- Repository Areas -->
<repository>
<id>Repository</id>
<name>Exchange Repository</name>
<url>https://maven.anypoint.mulesoft.com/api/v1/organizations/3284c114-3570-4feb-a444-7d90b56935a3/maven</url>
<layout>default</layout>
</repository>
<!-- Repository Areas -->
<repository>
<id>Central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>anypoint-exchange</id>
<name>Exchange Repository</name>
<url>https://maven.anypoint.mulesoft.com/api/v1/organizations/3284c114-3570-4feb-a444-7d90b56935a3/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-release</id>
<name>mulesoft release repository</name>
<layout>default</layout>
<url>http://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
`
I tried to fix it by adding the dependencies with the "<sharedLibraries>" tag in the pom.xml file but seems it didn't work, I dont know what else to try, I would apreciate any help.
Solution
This is a POM for a Mule 3 application. It will never work to build a Mule 4 application and Anypoint Studio 7.x (the version compatible with Mule 4 projects) will not be able to import it. Either you have an incorrect version or it is not really migrated. You need to create a pom.xml for a Mule 4 application. Since this is a complex POM it may not be trivial. And that is not counting any possible pending migration of the application itself.
Note that <sharedLibraries>
is used to solve classloading issues at execution time. It build not help with the build at all.
Answered By - aled
Answer Checked By - Marie Seifert (JavaFixing Admin)