首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Maven配置文件中执行pom.xml主类

在Maven配置文件中执行pom.xml主类
EN

Stack Overflow用户
提问于 2017-05-25 17:39:05
回答 1查看 893关注 0票数 0

我可以使用以下命令通过maven命令行启动我的应用程序:

代码语言:javascript
复制
mvn -f test-framework/pom.xml exec:java -Dexec.mainClass="com.application.app" -Dexec.classpathScope="test" -Dexec.args="/META-INF/spring/application-context.xml" -Denv=stubbed -Dsys=app -Dspring.profiles.active=app

我想修改我的项目的pom.xml,这样我就可以在测试作业期间使用Jenkins自动启动应用程序。我想知道如何将上面的Maven命令转换为Maven配置文件。我执行了以下操作,但应用程序无法启动:

代码语言:javascript
复制
                    <execution>
                        <id>start-app</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>mvn</executable>
                            <workingDirectory>${sut.path}/app/test-framework</workingDirectory>
                            <arguments>
                                <argument>exec:java</argument>
                                <argument>"-Dexec.mainClass=com.application.app"</argument>
                                <argument>"-Dexec.classpathScope=test"</argument>
                                <argument>"-Dexec.args=/META-INF/spring/application-context.xml"</argument>
                                <argument>-Denv=stubbed</argument>
                                <argument>-Dsys=app</argument>
                                <argument>-Dspring.profiles.active=pdc</argument>
                            </arguments>
                        </configuration>
                    </execution>

有没有人能帮我把这个命令放到pom.xml配置文件中?

EN

回答 1

Stack Overflow用户

发布于 2017-05-25 17:57:23

您是否尝试过设置<start-class>属性?

代码语言:javascript
复制
<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <start-class>com.stackoverflow.MyClass</start-class>
    </properties> 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44177186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档