Anypoint studio - 使用Maven错误运行项目

时间:2017-04-10 13:09:18

标签: maven mule anypoint-studio

我试图使用Maven在Anypoint studio中运行mule应用程序。

我为Java home和Maven home配置了env变量。

Anypoint工作室内的Maven测试顺利通过。

Maven test

JDK路径而不是Anypointstudio首选项中配置的JRE路径。我也 检查所有env组件以使用JDK。

JDK instead of JRE path

这是我的pom.xml文件

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>test3</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule</packaging>
<name>Mule test3 Application</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <mule.version>3.8.3</mule.version>
    <mule.tools.version>1.2</mule.tools.version>
</properties>

<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>src/main/api/</directory>
                            </resource>
                            <resource>
                                <directory>mappings/</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>
    <!-- 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>

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

当我运行app时,我在控制台中收到以下错误:

  

无法在项目测试3上执行目标:无法解决   项目com.mycompany的依赖项:test3:mule:1.0.0-SNAPSHOT:The   以下工件无法解决:   com.mulesoft.muleesb:骡子核-EE中:jar:3.8.3,   com.mulesoft.muleesb.modules:骡模块 - 弹簧 - 配置-EE:罐:3.8.3,   org.mule.transports:骡子运输文件中:jar:3.8.3,   org.mule.transports:骡子运输HTTP:罐子:3.8.3,   com.mulesoft.muleesb.transports:骡子运输-JDBC-EE中:jar:3.8.3,   com.mulesoft.muleesb.transports:骡子运输JMS-EE中:jar:3.8.3,   org.mule.transports:骡子运输-VM:罐子:3.8.3,   org.mule.modules:骡子模块的脚本中:jar:3.8.3,   org.mule.modules:骡子模块的XML:罐子:3.8.3,   org.mule.tests:mule-tests-functional:jar:3.8.3:找不到   com.mulesoft.muleesb:mule-core-ee:jar:3.8.3 in   http:repo1.maven.org/maven2/缓存在本地存储库中,   直到更新间隔为止,才会重新尝试解析   中心已过去或强制更新 - &gt; [帮助1]

配置有什么问题?任何想法?

2 个答案:

答案 0 :(得分:0)

我能够毫无问题地运行你的pom文件。可能你有阻止jar文件下载检查的防火墙问题?

<?xml version="1.0" encoding="UTF-8"?>
<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>test3</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule</packaging>
<name>Mule test3 Application</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <mule.version>3.8.3</mule.version>
    <mule.tools.version>1.2</mule.tools.version>
</properties>

<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>src/main/api/</directory>
                            </resource>
                            <resource>
                                <directory>mappings/</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>
    <!-- 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>

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

答案 1 :(得分:0)

您正在尝试使用企业版库而不提供EE存储库。请注意,您还需要一个帐户才能下载EE存储库。

与Mulesoft支持联系,他们应该为您提供有效的用户名/密码(如果您已经在使用EE许可证)并提供EE存储库的设置