我们使用maven为war文件构建一个webprojekts。使用tomcat7-maven-plugin,开发人员可以将项目从其构建目录推送到tomcat服务器。
我们现在也想使用maven来保持我们的生产tomcat服务器最新。我想到了一个元项目,它依赖于webproject,它只是从maven资源库下载war文件并将其推送到网络服务器。
我试着给它拍摄但失败了。
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>www1</artifactId>
<version>3.0.3-SNAPSHOT</version>
<name>www1</name>
<url>http://www.example.de</url>
<distributionManagement>
<repository>
<id>internal</id>
<url>http://archiva:8008/archiva/repository/internal/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
</plugin>
<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>TomcatAlpha</server>
<path>/search</path>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.foo</groupId>
<artifactId>webproject</artifactId>
<version>3.0.3-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
<repositories>
<repository>
<id>snapshots</id>
<name>Archiva Managed Snapshot Repository</name>
<url>http://archiva:8008/archiva/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>internal</id>
<name>Archiva Managed Internal Repository</name>
<url>http://archiva:8008/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
不幸的是这个项目什么都不做
$ mvn tomcat7:redeploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building www1 3.0.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:redeploy (default-cli) @ www1 >>>
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ www1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/wb/tmp/maven/new/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ www1 ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ www1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/wb/tmp/maven/new/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ www1 ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ www1 ---
[INFO] No tests to run.
[INFO] Surefire report directory: /home/wb/tmp/maven/new/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.2:jar (default-jar) @ www1 ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /home/wb/tmp/maven/new/target/www1-3.0.3-SNAPSHOT.jar
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:redeploy (default-cli) @ www1 <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:redeploy (default-cli) @ www1 ---
[INFO] Skipping non-war project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.213s
[INFO] Finished at: Tue Oct 14 10:31:33 CEST 2014
[INFO] Final Memory: 12M/304M
[INFO] ------------------------------------------------------------------------
有没有办法实现这一点,还是我试图以错误的方式使用maven?