如何修复 Maven Mulesoft 代码的构建错误
how to fix build errors for Maven Mulesoft code
我正在尝试使用 maven 构建 mulesoft 代码 Bamboo.Build 是成功的,但现在出现如下错误。我使用的是 Bamboo 6.5.0 和 jdk 1.8。使用 Maven 3。错误详细信息如下,我的 pom.xml、settings.xml 也是如此!任何意见表示赞赏!
build 01-Oct-2018 11:46:02 Caused by: org.apache.maven.plugin.MojoExecutionException: NoFileAssignedException
build 01-Oct-2018 11:46:02 at org.apache.maven.plugins.install.InstallMojo.installProject(InstallMojo.java:152)
build 01-Oct-2018 11:46:02 at org.apache.maven.plugins.install.InstallMojo.execute(InstallMojo.java:108)
build 01-Oct-2018 11:46:02 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
build 01-Oct-2018 11:46:02 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
build 01-Oct-2018 11:46:02 ... 20 more
build 01-Oct-2018 11:46:02 Caused by: org.apache.maven.shared.transfer.project.NoFileAssignedException: The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'.
build 01-Oct-2018 11:46:02 at org.apache.maven.shared.transfer.project.install.internal.DefaultProjectInstaller.install(DefaultProjectInstaller.java:116)
build 01-Oct-2018 11:46:02 at org.apache.maven.plugins.install.InstallMojo.installProject(InstallMojo.java:140)
build 01-Oct-2018 11:46:02 ... 23 more
我的 pom.xml 和 settings.xml 如下所示。
<?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.mule</groupId>
<artifactId>mycontacts-mule-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>mule</packaging>
<name>Mule mycontacts-mule-api Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mule.version>3.9.0</mule.version>
<mule.munit.support.version>3.9.1</mule.munit.support.version>
<munit.version>1.3.7</munit.version>
<mule.tools.version>1.2</mule.tools.version>
<application-name>mycontacts-mule-api</application-name>
<proxy.api.version>1.0:15535407</proxy.api.version>
<implementation.host>null</implementation.host>
<implementation.port>80</implementation.port>
<implementation.path>/api</implementation.path>
</properties>
<distributionManagement>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://prdbambap02:8081/artifactory/libs-release</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://prdbambap02:8081/artifactory/libs-snapshot</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
</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>
<testResources>
<testResource>
<directory>src/test/munit</directory>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
</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>
<!-- 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>
<!-- dependencies for Mule CoE Begins -->
<!-- https://mvnrepository.com/artifact/guru.nidi.raml/raml-tester-standalone -->
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>mule-module-proxy</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>mule-module-raml-el-gw</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!--<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId> mule-module-spring-config-gw</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency> -->
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>mule-module-spring-config-gw</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>api-gateway-client</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>gateway-core</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.munit</groupId>
<artifactId>mule-munit-support</artifactId>
<version>${mule.munit.support.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.munit</groupId>
<artifactId>munit-runner</artifactId>
<version>${munit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.munit.utils</groupId>
<artifactId>munit-dbserver-module</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-db</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-ws</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-json</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-cxf</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- dependencies for Mule CoE Ends -->
</dependencies>
<repositories>
<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>
</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>
和我的settings.xml如下
<?xml version="1.0" encoding="UTF-8"?>
<settings
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>org.mule.tools</pluginGroup>
</pluginGroups>
<servers>
<server>
<id>mule-ee-repo</id>
<username>balalba</username>
<password>blbalbab</password>
</server>
</servers>
<mirrors></mirrors>
<profiles>
<profile>
<id>mule-ee-profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<mule-maven-plugin-version>2.2.1</mule-maven-plugin-version>
<mule-username>username</mule-username>
<mule-password>password</mule-password>
<mule-client-id>blbalbalbal</mule-client-id>
<mule-client-secret>blablblalbalba</mule-client-secret>
<deployment-type>cloudhub</deployment-type>
<business-group>group</business-group>
<target-name>null</target-name>
<target-type>null</target-type>
<worker-size>Micro</worker-size>
<worker-count>1</worker-count>
<env-name>SIT</env-name>
</properties>
<repositories>
<repository>
<id>mule-ee-repo</id>
<name>mule-ee-repo</name>
<url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>mule-ee-profile</activeProfile>
</activeProfiles>
</settings>
同样的问题,这是因为新版本的 maven-install-plugin (3.0.0-M1)。
我的案例的解决方案是跳过使用自定义包装 (karaf-assembly) 的项目安装,因此在相关 pom.xml 中添加以下代码片段即可:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
当然,构建的工件不会以 .m2 目录结尾,但在我的情况下没问题。
看起来是新的maven安装插件和mulesoft代码不兼容的问题。在我的例子中,它有助于使用旧的安装插件 - 在 pluginManagement 中定义要使用的安装 maven 插件的所需版本:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
今天早上我们的管道 运行 遇到了同样的问题,但是为了在部署阶段发生时停止 NoFileAssignedException,我们必须在 Mule 应用程序的 POM 中明确排除它;
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin >
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
跳过应用程序的部署对我们来说不是问题,因为构建的工件实际上是由 Git 运行ner 在此刻(在那个特定环境中)部署的。
Apache Maven 将新版本的 Maven 安装插件部署到他们的存储库中。它似乎不应该去 Public 回购,但仍然。
解决方法是修复Mule POM文件中的Maven插件版本。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
官方支持消息:
原因:
A new version of the Maven Install Plugin has been published on the Maven public repositories (3.0.0-M1).
By default, Mule doesn't define a version for this plugin and picks the last one.
该页面列出了以下作为临时解决方案,并建议刷新以上 link 以进行更新。
更新pom.xml以指定Mule Maven插件使用的Maven版本:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
New - 以上为原方案,现为备选方案。推荐的解决方案是:
在 pom.xml 中更新 mule.tools.version:
<mule.tools.version>1.7</mule.tools.version>
并确保这个 属性 被 mule-app-maven-plugin 使用:
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
...
</plugin>
如果您随后收到有关无法解析的构建扩展的错误,运行 项目目录中的以下内容:
mvn dependency:purge-local-repository -DmanualInclude="org.mule.tools.maven:mule-app-maven-plugin:1.7"
请将插件更新到 1.7 版本,应该可以解决问题。
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>1.7</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
</configuration>
</plugin>
它正在选择 3.0.0-M1 版本,因为它安装在您的 m2 存储库中。您可以通过强制版本控制来限制它。打开.m2/repository/org/apache/maven/plugins/maven-install-plugin/maven-metadata-central-mirror.xml
2.5.2版本变更如下
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<versioning>
<latest>3.0.0-SNAPSHOT</latest>
<release>2.5.2</release>
<versions>
<version>maven-install-plugin</version>
.....
......
</versions>
<lastUpdated>20180930132927</lastUpdated>
</versioning>
</metadata>
在我的项目 .pom 文件中添加以下 explicit 后,此解决方案有效。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
在我的项目中已经包含了 artifiact maven-install-plugin 2.5.2,但没有包含 maven-deploy-plugin。看起来像是在水下使用神器maven-deploy-plugin。虽然它未在项目 .pom 文件中定义,但 mvn 会选择存储库中的最后一个版本(即 3.0.0-M1),该版本以错误结尾。
我正在尝试使用 maven 构建 mulesoft 代码 Bamboo.Build 是成功的,但现在出现如下错误。我使用的是 Bamboo 6.5.0 和 jdk 1.8。使用 Maven 3。错误详细信息如下,我的 pom.xml、settings.xml 也是如此!任何意见表示赞赏!
build 01-Oct-2018 11:46:02 Caused by: org.apache.maven.plugin.MojoExecutionException: NoFileAssignedException
build 01-Oct-2018 11:46:02 at org.apache.maven.plugins.install.InstallMojo.installProject(InstallMojo.java:152)
build 01-Oct-2018 11:46:02 at org.apache.maven.plugins.install.InstallMojo.execute(InstallMojo.java:108)
build 01-Oct-2018 11:46:02 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
build 01-Oct-2018 11:46:02 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
build 01-Oct-2018 11:46:02 ... 20 more
build 01-Oct-2018 11:46:02 Caused by: org.apache.maven.shared.transfer.project.NoFileAssignedException: The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'.
build 01-Oct-2018 11:46:02 at org.apache.maven.shared.transfer.project.install.internal.DefaultProjectInstaller.install(DefaultProjectInstaller.java:116)
build 01-Oct-2018 11:46:02 at org.apache.maven.plugins.install.InstallMojo.installProject(InstallMojo.java:140)
build 01-Oct-2018 11:46:02 ... 23 more
我的 pom.xml 和 settings.xml 如下所示。
<?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.mule</groupId>
<artifactId>mycontacts-mule-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>mule</packaging>
<name>Mule mycontacts-mule-api Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mule.version>3.9.0</mule.version>
<mule.munit.support.version>3.9.1</mule.munit.support.version>
<munit.version>1.3.7</munit.version>
<mule.tools.version>1.2</mule.tools.version>
<application-name>mycontacts-mule-api</application-name>
<proxy.api.version>1.0:15535407</proxy.api.version>
<implementation.host>null</implementation.host>
<implementation.port>80</implementation.port>
<implementation.path>/api</implementation.path>
</properties>
<distributionManagement>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://prdbambap02:8081/artifactory/libs-release</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://prdbambap02:8081/artifactory/libs-snapshot</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
</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>
<testResources>
<testResource>
<directory>src/test/munit</directory>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
</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>
<!-- 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>
<!-- dependencies for Mule CoE Begins -->
<!-- https://mvnrepository.com/artifact/guru.nidi.raml/raml-tester-standalone -->
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>mule-module-proxy</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>mule-module-raml-el-gw</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!--<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId> mule-module-spring-config-gw</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency> -->
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>mule-module-spring-config-gw</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>api-gateway-client</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>gateway-core</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.munit</groupId>
<artifactId>mule-munit-support</artifactId>
<version>${mule.munit.support.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.munit</groupId>
<artifactId>munit-runner</artifactId>
<version>${munit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.munit.utils</groupId>
<artifactId>munit-dbserver-module</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-db</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-ws</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-json</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-cxf</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- dependencies for Mule CoE Ends -->
</dependencies>
<repositories>
<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>
</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>
和我的settings.xml如下
<?xml version="1.0" encoding="UTF-8"?>
<settings
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>org.mule.tools</pluginGroup>
</pluginGroups>
<servers>
<server>
<id>mule-ee-repo</id>
<username>balalba</username>
<password>blbalbab</password>
</server>
</servers>
<mirrors></mirrors>
<profiles>
<profile>
<id>mule-ee-profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<mule-maven-plugin-version>2.2.1</mule-maven-plugin-version>
<mule-username>username</mule-username>
<mule-password>password</mule-password>
<mule-client-id>blbalbalbal</mule-client-id>
<mule-client-secret>blablblalbalba</mule-client-secret>
<deployment-type>cloudhub</deployment-type>
<business-group>group</business-group>
<target-name>null</target-name>
<target-type>null</target-type>
<worker-size>Micro</worker-size>
<worker-count>1</worker-count>
<env-name>SIT</env-name>
</properties>
<repositories>
<repository>
<id>mule-ee-repo</id>
<name>mule-ee-repo</name>
<url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>mule-ee-profile</activeProfile>
</activeProfiles>
</settings>
同样的问题,这是因为新版本的 maven-install-plugin (3.0.0-M1)。 我的案例的解决方案是跳过使用自定义包装 (karaf-assembly) 的项目安装,因此在相关 pom.xml 中添加以下代码片段即可:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
当然,构建的工件不会以 .m2 目录结尾,但在我的情况下没问题。
看起来是新的maven安装插件和mulesoft代码不兼容的问题。在我的例子中,它有助于使用旧的安装插件 - 在 pluginManagement 中定义要使用的安装 maven 插件的所需版本:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
今天早上我们的管道 运行 遇到了同样的问题,但是为了在部署阶段发生时停止 NoFileAssignedException,我们必须在 Mule 应用程序的 POM 中明确排除它;
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin >
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
跳过应用程序的部署对我们来说不是问题,因为构建的工件实际上是由 Git 运行ner 在此刻(在那个特定环境中)部署的。
Apache Maven 将新版本的 Maven 安装插件部署到他们的存储库中。它似乎不应该去 Public 回购,但仍然。
解决方法是修复Mule POM文件中的Maven插件版本。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
官方支持消息:
原因:
A new version of the Maven Install Plugin has been published on the Maven public repositories (3.0.0-M1). By default, Mule doesn't define a version for this plugin and picks the last one.
该页面列出了以下作为临时解决方案,并建议刷新以上 link 以进行更新。
更新pom.xml以指定Mule Maven插件使用的Maven版本:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
New - 以上为原方案,现为备选方案。推荐的解决方案是:
在 pom.xml 中更新 mule.tools.version:
<mule.tools.version>1.7</mule.tools.version>
并确保这个 属性 被 mule-app-maven-plugin 使用:
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
...
</plugin>
如果您随后收到有关无法解析的构建扩展的错误,运行 项目目录中的以下内容:
mvn dependency:purge-local-repository -DmanualInclude="org.mule.tools.maven:mule-app-maven-plugin:1.7"
请将插件更新到 1.7 版本,应该可以解决问题。
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>1.7</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
</configuration>
</plugin>
它正在选择 3.0.0-M1 版本,因为它安装在您的 m2 存储库中。您可以通过强制版本控制来限制它。打开.m2/repository/org/apache/maven/plugins/maven-install-plugin/maven-metadata-central-mirror.xml
2.5.2版本变更如下
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<versioning>
<latest>3.0.0-SNAPSHOT</latest>
<release>2.5.2</release>
<versions>
<version>maven-install-plugin</version>
.....
......
</versions>
<lastUpdated>20180930132927</lastUpdated>
</versioning>
</metadata>
在我的项目 .pom 文件中添加以下 explicit 后,此解决方案有效。
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin>
在我的项目中已经包含了 artifiact maven-install-plugin 2.5.2,但没有包含 maven-deploy-plugin。看起来像是在水下使用神器maven-deploy-plugin。虽然它未在项目 .pom 文件中定义,但 mvn 会选择存储库中的最后一个版本(即 3.0.0-M1),该版本以错误结尾。