我正在使用tomcat7-maven-plugin来部署我的spring批量管理应用程序,
下面是我在pom中的配置,
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- Tomcat 7 has a different manager path - text - than other versions -->
<url>http://localhost:8081/manager/text</url>
<username>myusername</username>
<password>mypassword</password>
<path>/${project.build.finalName}</path>
<update>true</update>
</configuration>
</plugin>
我正在跑步,
mvn clean install tomcat7:deploy
虽然它成功完成,但几乎(4-5分钟)完成此命令需要很长时间。
以下是命令的输出。上传war文件后收到响应需要很长时间。你可以观察下面的输出,花了4.16分钟。
它工作得很快,直到它显示消息“上传..”但在此之后它一直等待响应4-5分钟。
我需要在多个服务器(5台服务器)上部署应用程序,因此需要25分钟,这对于仅部署来说太长了。
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.st:batch:war:1.0.0-BUILD-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework.batch:spring-batch-core:jar -> version ${spring.batch.version} vs (?) @ line 125, column 15
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework.batch:spring-batch-infrastructure:jar -> version ${spring.batch.version} vs (?) @ line 129, column 15
[WARNING] 'build.plugins.plugin.version' for org.mortbay.jetty:maven-jetty-plugin is missing. @ line 182, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing. @ line 189, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.springframework.batch:spring-batch-admin-parent:1.3.0.RC1, /home/ubuntu/.m2/repository/org/springframework/batch/spring-batch-admin-parent/1.3.0.RC1/spring-batch-admin-parent-1.3.0.RC1.pom, line 245, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ org.springframework.batch:spring-batch-admin-parent:1.3.0.RC1, /home/ubuntu/.m2/repository/org/springframework/batch/spring-batch-admin-parent/1.3.0.RC1/spring-batch-admin-parent-1.3.0.RC1.pom, line 253, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building st 1.0.0-BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ batch ---
[INFO] Deleting /home/ubuntu/java/spring/batch/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ batch ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 105 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ batch ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 53 source files to /home/ubuntu/java/spring/batch/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ batch ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ubuntu/java/spring/batch/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ batch ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ batch ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ batch ---
[INFO] Packaging webapp
[INFO] Assembling webapp [batch] in [/home/ubuntu/java/spring/batch/target/batch-1.0.0-BUILD-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/ubuntu/java/spring/batch/src/main/webapp]
[INFO] Webapp assembled in [130 msecs]
[INFO] Building war: /home/ubuntu/java/spring/batch/target/batch-1.0.0-BUILD-SNAPSHOT.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ batch ---
[INFO] Installing /home/ubuntu/java/spring/batch/target/batch-1.0.0-BUILD-SNAPSHOT.war to /home/ubuntu/.m2/repository/com/st/batch/1.0.0-BUILD-SNAPSHOT/batch-1.0.0-BUILD-SNAPSHOT.war
[INFO] Installing /home/ubuntu/java/spring/batch/pom.xml to /home/ubuntu/.m2/repository/com/st/batch/1.0.0-BUILD-SNAPSHOT/batch-1.0.0-BUILD-SNAPSHOT.pom
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) @ batch >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ batch ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 105 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ batch ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ batch ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ubuntu/java/spring/batch/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ batch ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ batch ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ batch ---
[INFO] Packaging webapp
[INFO] Assembling webapp [batch] in [/home/ubuntu/java/spring/batch/target/batch-1.0.0-BUILD-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/ubuntu/java/spring/batch/src/main/webapp]
[INFO] Webapp assembled in [73 msecs]
[INFO] Building war: /home/ubuntu/java/spring/batch/target/batch-1.0.0-BUILD-SNAPSHOT.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) @ batch <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) @ batch ---
[INFO] Deploying war to http://localhost:8081/batch-1.0.0-BUILD-SNAPSHOT
Uploading: http://localhost:8081/manager/text/deploy?path=%2Fbatch-1.0.0-BUILD-SNAPSHOT&update=true
Uploaded: http://localhost:8081/manager/text/deploy?path=%2Fbatch-1.0.0-BUILD-SNAPSHOT&update=true (16362 KB at 116869.5 KB/sec)
[INFO] tomcatManager status code:200, ReasonPhrase:OK
[INFO] OK - Deployed application at context path /batch-1.0.0-BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:16 min
[INFO] Finished at: 2014-07-23T11:49:33+00:00
[INFO] Final Memory: 23M/303M
[INFO] -------------------------
答案 0 :(得分:0)
您可以使用以下命令部署您的应用。它将有助于重新计算所需的时间,但它不会停止Uploading:
&amp;自等待Tomcat以来Uploaded:
部分。
mvn -T 1C install tomcat7:redeploy-only -DskipTests -offline
-T 1C
:这意味着我们将在部署机器上使用每个核心1个线程