MUnit测试导致maven构建失败

时间:2016-11-09 18:07:28

标签: maven anypoint-studio munit

我有一个Maven化的Anypoint Studio项目,在执行mvn clean package时失败了Maven构建;但是,运行mvn clean package -DskipMunitTests会导致成功构建。

堆栈追踪:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.443 s
[INFO] Finished at: 2016-11-09T09:03:52-08:00
[INFO] Final Memory: 35M/494M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test (test) on project template: Execution test of goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test failed: org.mule.api.config.ConfigurationException: Configuration problem: Failed to import bean definitions from URL location [classpath:template.xml]
[ERROR] Offending resource: URL [file:/C:/Projects/ERP/Integrations/Workflows/Workflows-Dev/template/target/test-classes/template-test-suite.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [template.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option (org.mule.api.lifecycle.InitialisationException): scala.Option
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test (test) on project template: Execution test of goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test failed: org.mule.api.config.ConfigurationException: Configuration problem: Failed to import bean definitions from URL location [classpath:template.xml]
Offending resource: URL [file:/C:/Projects/ERP/Integrations/Workflows/Workflows-Dev/template/target/test-classes/template-test-suite.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [template.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option (org.mule.api.lifecycle.InitialisationException)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution test of goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test failed: org.mule.api.config.ConfigurationException: Configuration problem: Failed to import bean definitions from URL location [classpath:template.xml]
Offending resource: URL [file:/C:/Projects/ERP/Integrations/Workflows/Workflows-Dev/template/target/test-classes/template-test-suite.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [template.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option (org.mule.api.lifecycle.InitialisationException)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
Caused by: java.lang.RuntimeException: org.mule.api.config.ConfigurationException: Configuration problem: Failed to import bean definitions from URL location [classpath:template.xml]
Offending resource: URL [file:/C:/Projects/ERP/Integrations/Workflows/Workflows-Dev/template/target/test-classes/template-test-suite.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [template.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option (org.mule.api.lifecycle.InitialisationException)
    at org.mule.munit.runner.mule.MunitSuiteRunner.<init>(MunitSuiteRunner.java:44)
    at org.mule.MUnitMojo.buildRunnerFor(MUnitMojo.java:323)
    at org.mule.MUnitMojo.doExecute(MUnitMojo.java:180)
    at org.mule.MUnitMojo.execute(MUnitMojo.java:125)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    ... 21 more
Caused by: org.mule.api.config.ConfigurationException: Configuration problem: Failed to import bean definitions from URL location [classpath:template.xml]
Offending resource: URL [file:/C:/Projects/ERP/Integrations/Workflows/Workflows-Dev/template/target/test-classes/template-test-suite.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [template.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option (org.mule.api.lifecycle.InitialisationException)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
    at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:89)
    at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:222)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:81)
    at org.mule.munit.runner.MunitMuleContextFactory.createMuleContext(MunitMuleContextFactory.java:86)
    at org.mule.munit.runner.MuleContextManager.createMule(MuleContextManager.java:114)
    at org.mule.munit.runner.MuleContextManager.startMule(MuleContextManager.java:67)
    at org.mule.munit.runner.mule.MunitSuiteRunner.<init>(MunitSuiteRunner.java:38)
    ... 25 more
Caused by: org.mule.api.lifecycle.InitialisationException: Configuration problem: Failed to import bean definitions from URL location [classpath:template.xml]
Offending resource: URL [file:/C:/Projects/ERP/Integrations/Workflows/Workflows-Dev/template/target/test-classes/template-test-suite.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [template.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:112)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:177)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:100)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43)
    ... 33 more
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:template.xml]
Offending resource: URL [file:/C:/Projects/ERP/Integrations/Workflows/Workflows-Dev/template/target/test-classes/template-test-suite.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [template.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:235)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:186)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:171)
    at org.mule.config.spring.MuleBeanDefinitionDocumentReader.parseBeanDefinitions(MuleBeanDefinitionDocumentReader.java:56)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:144)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:100)
    at org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.handleSpringElements(MuleHierarchicalBeanDefinitionParserDelegate.java:180)
    at org.mule.munit.runner.spring.config.reader.MunitBeanDefinitionParserDelegate.parseCustomElement(MunitBeanDefinitionParserDelegate.java:41)
    at org.mule.munit.runner.spring.config.reader.MunitBeanDefinitionParserDelegate.parseCustomElement(MunitBeanDefinitionParserDelegate.java:82)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1417)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:180)
    at org.mule.config.spring.MuleBeanDefinitionDocumentReader.parseBeanDefinitions(MuleBeanDefinitionDocumentReader.java:56)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:144)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:100)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:510)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
    at org.mule.munit.runner.spring.config.MunitApplicationContext.communicateMuleContextToParsers(MunitApplicationContext.java:125)
    at org.mule.munit.runner.spring.config.MunitApplicationContext.loadBeanDefinitions(MunitApplicationContext.java:98)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452)
    at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:108)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:104)
    ... 36 more
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [template.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:229)
    ... 61 more
Caused by: org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option
    at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:140)
    at org.mule.munit.runner.spring.config.reader.MunitBeanDefinitionParserDelegate.parseCustomElement(MunitBeanDefinitionParserDelegate.java:45)
    at org.mule.munit.runner.spring.config.reader.MunitBeanDefinitionParserDelegate.parseCustomElement(MunitBeanDefinitionParserDelegate.java:82)
    at org.mule.munit.runner.spring.config.reader.MunitBeanDefinitionParserDelegate.parseCustomElement(MunitBeanDefinitionParserDelegate.java:82)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1417)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:180)
    at org.mule.config.spring.MuleBeanDefinitionDocumentReader.parseBeanDefinitions(MuleBeanDefinitionDocumentReader.java:56)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:144)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:100)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:510)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
    ... 66 more
Caused by: java.lang.NoClassDefFoundError: scala/Option
    at com.mulesoft.weave.mule.config.WeaveNamespaceHandler.init(WeaveNamespaceHandler.scala:22)
    at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:131)
    ... 76 more
Caused by: java.lang.ClassNotFoundException: scala.Option
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
    ... 78 more
[ERROR] 
[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/PluginExecutionException

POM文件:

<?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.savers</groupId>
    <artifactId>template</artifactId>
    <version>1.0.0.16</version>
    <packaging>mule</packaging>
    <name>Mule Template Application</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <mule.version>3.8.1</mule.version>
        <mule.tools.version>1.2</mule.tools.version>
        <munit.version>1.2.1</munit.version>
        <mule.munit.support.version>3.8.1</mule.munit.support.version>
        <maven.install.plugin.version>2.3.1</maven.install.plugin.version>
        <mule-maven-plugin.version>2.1.2</mule-maven-plugin.version>
        <mule-mmc-rest-plugin.version>1.2.0</mule-mmc-rest-plugin.version>
        <cglib.version>3.2.2</cglib.version>
        <sqljdbc4.version>4.0</sqljdbc4.version>
    </properties>

    <parent>
        <groupId>com.savers.parent</groupId>
        <artifactId>savers-parent</artifactId>
        <version>1.0.0.4</version>
    </parent>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven.install.plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-app-maven-plugin</artifactId>
                <version>${mule.tools.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <copyToAppsDirectory>false</copyToAppsDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.mule.tools</groupId>
                <artifactId>mule-maven-plugin</artifactId>
                <version>${mule-maven-plugin.version}</version>
                <configuration>
                    <muleDistribution>
                        <groupId>com.mulesoft.muleesb.distributions</groupId>
                        <artifactId>mule-ee-distribution-standalone</artifactId>
                        <version>${mule.version}</version>
                        <type>tar.gz</type>
                    </muleDistribution>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.mulesoft.munit.tools</groupId>
                <artifactId>munit-maven-plugin</artifactId>
                <version>${munit.version}</version>
                <configuration>
                    <dynamicPorts>
                        <dynamicPort>a.dynamic.port</dynamicPort>
                    </dynamicPorts>
                </configuration>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.nicholasastuart</groupId>
                <artifactId>mule-mmc-rest-plugin</artifactId>
                <version>${mule-mmc-rest-plugin.version}</version>
                <executions>
                    <execution>
                        <id>mule-deploy</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                        <configuration>
                            <name>${project.artifactId}</name>
                            <username>${mmc.user}</username>
                            <password>${mmc.password}</password>
                            <version>${project.version}</version>
                            <serverGroup>${mmc.serverGroup}</serverGroup>
                            <muleApiUrl>${mmc.url}</muleApiUrl>
                        </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>
        <!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc4 -->
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
            <version>${sqljdbc4.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-http</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>${cglib.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>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>
    </dependencies>

    <repositories>
        <repository>
            <id>releases</id>
            <name>Savers</name>
            <url>some url here</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>snapshots</id>
            <name>Snapshots</name>
            <url>some url here</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <layout>default</layout>
        </repository>
        <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>

进口:

<munit:config name="munit" doc:name="MUnit configuration" mock-connectors="false" mock-inbounds="false"/>
<spring:beans>
    <spring:import resource="classpath:template.xml"/>
    <spring:import resource="classpath:global.xml"/>
</spring:beans>

我在src / main / app和src / main / resources文件夹中有.properties个文件,我尝试导入但是没有成功。

我应该提一下,Munit测试在Anypoint Studio中成功运行。

我已经和它搏斗了几天,似乎无法发现问题。

这个问题Mavenized Mule project but Munit test run is failing非常接近我的问题,但仍然不是我需要的。

非常感谢任何帮助或见解。

感谢。

2 个答案:

答案 0 :(得分:1)

我遇到了这个问题,尽管我的测试套件也是如此。 MUnit测试将在Studio中传递,但不在mvn clean test传递。我在mule-plugin-weave的依赖项列表中已经有pom.xml

我在Mulesoft论坛(https://forums.mulesoft.com/questions/52086/problem-with-dependency-381-munit-and-dataweave.html#comment-52089)中接受了Diego的建议,删除了本地Dataweave依赖关系(.m2/repository/com/mulesoft/weave)并重新运行mvn clean test。它下载了所有新鲜内容,现在可以在Studio和命令行中使用。

希望这有帮助!

答案 1 :(得分:0)

这种情况正在发生,因为;在munit中存在数据编织依赖性的问题。 只需将dataweave组件拖放到项目流中并保存即可。它将在POM文件中添加依赖项。然后你可以删除dataweave。  之后构建您的项目。