0

我有一个 jenkins ci,它可以构建我们的项目并制作一个 .war 文件。但我无法将它部署到詹金斯,我该怎么做?

我的 pom.xml 看起来像这样:

<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MavenWeb</groupId>
<artifactId>MavenWeb</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<description></description>
<distributionManagement>
<repository>
  <uniqueVersion>false</uniqueVersion>
  <id>e-ject.se</id>
  <name>e-ject.se</name>
  <url>http://e-ject.se/MavenWeb</url>
  <layout>default</layout>
</repository>
 </distributionManagement>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.0.1</version>
        </plugin>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat6-maven-plugin</artifactId>
            <version>2.0-beta-1</version>
                <configuration>
    <url>http://e-ject.se:8080/manager</url>
    <server>e-ject.se</server>
    <path>/MavenWeb</path>
</configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
</dependencies>
</project>

我在网上找到的 settings.xml 中添加了所有信息。我可以使用用户名和密码登录到 e-ject.se:8080/manager/html。

<server>
    <id>e-ject.se</id>
    <username>jonathan</username>
    <password>*****</password>
    <filePermissions>664</filePermissions>
    <directoryPermissions>775</directoryPermissions>
    <configuration></configuration>
</server>

我在詹金斯控制台中得到了这个:

mavenExecutionResult exceptions not empty
message : Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy     (default-deploy) on project MavenWeb: 
Failed to deploy artifacts: Could not transfer artifact   MavenWeb:MavenWeb:war:0.0.1-20120412.150346-1 from/to e-ject.se 
(http://e-ject.se/MavenWeb): Failed to transfer file: http://e-ject.se/MavenWeb/MavenWeb/MavenWeb/0.0.1-SNAPSHOT/MavenWeb-0.0.1-20120412.150346-1.war. 
Return code is: 405

如果我只是在 jenkins 中添加 tomcat:deploy 而不是 deploy

我得到:

 mavenExecutionResult exceptions not empty
 message : Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli)     on project MavenWeb: Cannot invoke Tomcat manager
 cause : Cannot invoke Tomcat manager

然后:

Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL:   http://localhost:8080/manager/deploy?path=%2FMavenWeb&war=

有人可以帮我让它工作吗,我已经阅读了大量指南,但我无法让它工作!

尊重乔纳森

4

1 回答 1

0

我意识到我有不止一个詹金斯安装了 maven,而且我之前的安装误导了我!有时,重新开始并正确地做会更好。

于 2014-04-07T13:14:53.203 回答