我有一个maven项目,其中包括4个模块:新闻管理,新闻普通,新闻管理和新闻客户。新闻管理模块是父模块。我输入mvn tomcat7.deploy -Dmaven.test.skip=true
,结果是:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] news-management
[INFO] news-common
[INFO] news-admin
[INFO] news-client
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building news-management 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ news-management ---
[INFO] Installing C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\pom.xml to C:\Users\Siarhei_Liauko\.m2\repository\co
m\epam\news-management\1.0\news-management-1.0.pom
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ news-management >>>
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ news-management <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ news-management ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building news-common 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ news-common ---
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ news-common ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1251, i.e. build is platform dependent!
[INFO] Compiling 46 source files to C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-common\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ news-common ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ news-common ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ news-common ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ news-common ---
[INFO] Building jar: C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-common\target\news-common-1.0.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ news-common ---
[INFO] Installing C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-common\target\news-common-1.0.jar to C:\Users\S
iarhei_Liauko\.m2\repository\com\epam\news-common\1.0\news-common-1.0.jar
[INFO] Installing C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-common\pom.xml to C:\Users\Siarhei_Liauko\.m2\r
epository\com\epam\news-common\1.0\news-common-1.0.pom
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ news-common >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ news-common ---
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ news-common ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1251, i.e. build is platform dependent!
[INFO] Compiling 46 source files to C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-common\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ news-common ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ news-common ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ news-common ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ news-common ---
[INFO] Building jar: C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-common\target\news-common-1.0.jar
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ news-common <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ news-common ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building news-admin 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ news-admin ---
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ news-admin ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ news-admin ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ news-admin ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ news-admin ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) @ news-admin ---
[INFO] Packaging webapp
[INFO] Assembling webapp [news-admin] in [C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-admin\target\news-admin
-1.0]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-admin\src\main\webapp]
[INFO] Webapp assembled in [372 msecs]
[INFO] Building war: C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-admin\target\news-admin-1.0.war
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ news-admin ---
[INFO] Installing C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-admin\target\news-admin-1.0.war to C:\Users\Sia
rhei_Liauko\.m2\repository\com\epam\news-admin\1.0\news-admin-1.0.war
[INFO] Installing C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-admin\pom.xml to C:\Users\Siarhei_Liauko\.m2\re
pository\com\epam\news-admin\1.0\news-admin-1.0.pom
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ news-admin >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ news-admin ---
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ news-admin ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ news-admin ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ news-admin ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ news-admin ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) @ news-admin ---
[INFO] Packaging webapp
[INFO] Assembling webapp [news-admin] in [C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-admin\target\news-admin
-1.0]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-admin\src\main\webapp]
[INFO] Webapp assembled in [323 msecs]
[INFO] Building war: C:\Users\Siarhei_Liauko\Projects\Temp\News-Management\news-admin\target\news-admin-1.0.war
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ news-admin <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ news-admin ---
[INFO] Deploying war to http://localhost:8082/news-admin
Uploading: http://localhost:8082/manager/text/deploy?path=%2Fnews-admin
2074/29426 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8082/manager/text/deploy?path=%2Fnews-admin
2074/29426 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8082/manager/text/deploy?path=%2Fnews-admin
2074/29426 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8082/manager/text/deploy?path=%2Fnews-admin
2074/29426 KB
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] news-management .................................... SUCCESS [ 1.099 s]
[INFO] news-common ........................................ SUCCESS [ 5.230 s]
[INFO] news-admin ......................................... FAILURE [ 12.158 s]
[INFO] news-client ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.039 s
[INFO] Finished at: 2016-08-17T19:56:08+03:00
[INFO] Final Memory: 33M/273M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project news-admin:
Cannot invoke Tomcat manager: Connection reset by peer: socket write error -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :news-admin
新闻管理pom.xml:
<modelVersion>4.0.0</modelVersion>
<groupId>com.epam</groupId>
<artifactId>news-management</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>news-common</module>
<module>news-admin</module>
<module>news-client</module>
</modules>
<properties>
<spring.version>4.2.5.RELEASE</spring.version>
<spring.security.version>4.1.0.RELEASE</spring.security.version>
<news.management.version>1.0</news.management.version>
<ojdbc.version>10.2.0.3.0</ojdbc.version>
<tomcat.maven.plugin.vercion>2.2</tomcat.maven.plugin.vercion>
</properties>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>${ojdbc.version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat.maven.plugin.vercion}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
News-admin pom.xml:
<parent>
<artifactId>news-management</artifactId>
<groupId>com.epam</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>news-admin</artifactId>
<packaging>war</packaging>
<properties>
<jstl.version>1.2</jstl.version>
<jsp.api.version>2.2</jsp.api.version>
<servlet.version>3.1.0</servlet.version>
<apache.tiles.version>3.0.5</apache.tiles.version>
</properties>
<dependencies>
<dependency>
<groupId>com.epam</groupId>
<artifactId>news-common</artifactId>
<version>${news.management.version}</version>
</dependency>
<!-- Spring MVC -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Spring security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring.security.version}</version>
</dependency>
<!-- JSTL API -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<!-- Servlet API -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<!-- Apache tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>${apache.tiles.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8082/manager/text</url>
<server>Tomcat</server>
<username>deployer</username>
<password>deployer</password>
<path>/news-admin</path>
</configuration>
</plugin>
</plugins>
</build>
新闻客户端pom.xml:
<parent>
<artifactId>news-management</artifactId>
<groupId>com.epam</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>news-client</artifactId>
<packaging>war</packaging>
<properties>
<jstl.version>1.2</jstl.version>
<jsp.api.version>2.2</jsp.api.version>
<servlet.version>3.1.0</servlet.version>
<apache.tiles.version>3.0.5</apache.tiles.version>
</properties>
<dependencies>
<dependency>
<groupId>com.epam</groupId>
<artifactId>news-common</artifactId>
<version>${news.management.version}</version>
</dependency>
<!-- JSP API -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp.api.version}</version>
</dependency>
<!-- Servlet API -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<!-- Apache tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>${apache.tiles.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8082/manager/text</url>
<server>tomcat</server>
<username>deployer</username>
<password>deployer</password>
<path>/news-client</path>
</configuration>
</plugin>
</plugins>
</build>
Tomcat的users.xml中:
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<user username="deployer" password="deployer" role="manager-gui,manager-script"/>
Maven settings.xml:
<server>
<id>Tomcat</id>
<username>deployer</username>
<password>deployer</password>
</server>
我尝试使用http://localhost:8082/management和http://localhost:8082/management/http。我尝试在web.xml中更改max-file-size
和max-request-size
。我试图添加到部署用户角色manager-jmx和admin。它没有帮助。在我的情况下出现这种错误的原因是什么?
答案 0 :(得分:-1)
行。我已经解决了这个问题。当我将tomcat-users.xml
中的用户从deployer
重命名为admin
时,它就会开始工作。