使用Jenkins从Maven到Tomcat 8的自动部署

时间:2017-06-16 14:03:33

标签: tomcat jenkins

我已经设置Jenkins从Maven自动部署到Tomcat 8,但是我收到了这个错误:

Waiting for Jenkins to finish collecting data[ERROR] Unknown lifecycle phase "package". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/LifecyclePhaseNotFoundException

[JENKINS] Archiving /root/.jenkins/workspace/mywebapp/pom.xml to com.tastyminerals.poems/poemcollection/0.0.1-SNAPSHOT/poemcollection-0.0.1-SNAPSHOT.pom
channel stopped
Finished: FAILURE

Tomcat 8,Maven 3.3.9,Java 1.8,根据我在下面设置的配置

Tomcat的:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
    <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
    <user username="admin" password="password" roles="manager-gui,manager-script" />
</tomcat-users>

对于此路径中的Maven身份验证%MAVEN_PATH%/conf/settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings ...>
    <servers>
        <server>
            <id>TomcatServer</id>
            <username>admin</username>
            <password>password</password>
        </server>
    </servers>
</settings>
<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <server>TomcatServer</server>
        <path>/mywebapp</path>
    </configuration>
</plugin>

1 个答案:

答案 0 :(得分:0)

Waiting for Jenkins to finish collecting data[ERROR] Unknown lifecycle phase "packege".

从上面的消息可以清楚地看出,你提到了错误的maven目标名称。

而不是“packege”使用“包”。拼写错误就在那里。

但是“package”目标只创建jar / war / ear文件,只是它不会部署到tomcat服务器。

使用tomcat7:deploy目标将工件部署到tomcat服务器。