【问题标题】:running mule from maven not seeing mule-app.properties从 maven 运行 mule 没有看到 mule-app.properties
【发布时间】:2017-12-08 14:46:47
【问题描述】:

这是我的执行配置:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>java</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <mainClass>org.mule.MuleServer</mainClass>
                <arguments>
                    <argument>-config</argument>
                    <argument>src/main/app/prioritisation-api.xml</argument>
                    <argument>-classpath</argument>
                    <argument>src/main/app</argument>
                </arguments>
                <classpathScope>compile</classpathScope>
            </configuration>
        </plugin>

我得到的错误

org.springframework.beans.MethodInvocationException: Property 'protocol' threw exception; nested exception is java.lang.IllegalArgumentException: Address '${prioritisation.api.console.endpoint}' for protocol 'http' should start with http://

这向我表明 mule-app.properties 没有得到正确解决。问题是,当我运行为 Maven Mule 项目时,这一切都在 Anypoint Studio 中有效。我错过了什么?

编辑:

我正在尝试使用以下方式运行 mule:mvn exec:java -DrunMule

骡版:&lt;mule.version&gt;3.4.0&lt;/mule.version&gt;

属性位于:src/main/app/mule-app.properties

Maven 版本:Apache Maven 3.2.1

【问题讨论】:

  • mule-app.properties are not being resolved properly 是什么意思?你能显示你的完整pom文件吗?这些物业位于何处?您使用哪个 Maven 版本?你怎么称呼Maven?它可以从命令行工作吗?
  • 我在问题中添加了版本等。属性未正确解析,因为它没有将 ${prioritisation.api.console.endpoint} 替换为属性值。

标签: spring maven mule


【解决方案1】:

虽然它在 Anypoint Studio 中运行,但没有这个,要使用 maven exec 运行,您需要添加 &lt;context:property-placeholder location="classpath:mule-app.properties" /&gt;。我不确定它在 Anypoint 中是如何工作的(大概也在 Mule 容器中)?

【讨论】:

    【解决方案2】:

    我认为您需要将属性添加到 src/main/resources 文件夹中名为 environment.properties 的文件中,并使用 &lt;context:property-placeholder location="environment.properties"/&gt; 添加其引用

    【讨论】:

    • 感谢 Gahan,我是这个论坛的新手,因此不知道可用的格式选项
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-18
    • 2015-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-25
    • 1970-01-01
    相关资源
    最近更新 更多