Maven Clean在tomcat 1.8的sts中不起作用

我将项目从1)Tomcat 1.7升级到tomcat 1.8 2)STS 2. 升级到STS3。 3)maven 2. *升级到Maven 3. *

在STS中升级时,当我做Maven清理时,我得到以下错误

[INFO] Scanning for projects...

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building Bna4AllService 0.0.1

[INFO] ------------------------------------------------------------------------

[INFO] Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/tomcat-maven-plugin/maven-metadata.xml

[WARNING] Could not transfer metadata org.codehaus.mojo:tomcat-maven-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 12.776 s

[INFO] Finished at: 2016-04-14T17:46:34+05:30

[INFO] Final Memory: 8M/121M

[INFO] ------------------------------------------------------------------------

[ERROR] Error resolving version for plugin 'org.codehaus.mojo:tomcat-maven-plugin' from the repositories [local (C:\Users\nreddy\.m2\repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [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/PluginVersionResolutionException

我的POM.xml文件在下面。

<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.eeft</groupId>

<artifactId>bna4AllService</artifactId>

<version>0.0.1</version>

<packaging>war</packaging>

<name>Bna4AllService</name>

<dependencies>

<dependency>

<groupId>org.apache.cxf</groupId>

<artifactId>cxf-rt-frontend-jaxws</artifactId>

<version>2.7.3</version>

</dependency>

<dependency>

<groupId>org.apache.cxf</groupId>

<artifactId>cxf-rt-transports-http</artifactId>

<version>2.7.3</version>

</dependency>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.11</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring</artifactId>

<version>2.5.6.SEC03</version>

</dependency>

<dependency>

<groupId>commons-lang</groupId>

<artifactId>commons-lang</artifactId>

<version>2.3</version>

</dependency>

<dependency>

<groupId>com.eeft</groupId>

<artifactId>bna4AllServiceImplementation</artifactId>

<version>0.0.1</version>

</dependency>

<dependency>

<groupId>log4j</groupId>

<artifactId>log4j</artifactId>

<version>1.2.14</version>

</dependency>

</dependencies>

<build>

<finalName>${project.artifactId}</finalName>

<pluginManagement>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-war-plugin</artifactId>

<version>2.3</version>

<configuration>

<archive>

<manifest>

</manifest>

<manifestEntries>

<DisableIBMJAXWSEngine>true</DisableIBMJAXWSEngine>

</manifestEntries>

</archive>

</configuration>

</plugin>

<plugin>

<groupId>org.codehaus.mojo</groupId>

<artifactId>tomcat-maven-plugin</artifactId>

<configuration>

<server>myserver</server>

<url>http://localhost:8080/manager/html</url>

</configuration>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<configuration>

<source>1.7</source>

<target>1.7</target>

<skipTests>true</skipTests>

</configuration>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-surefire-plugin</artifactId>

<version>2.13</version>

</plugin>

</plugins>

</pluginManagement>

</build>

</project>

我对mvaen版本非常陌生,请帮助我解决问题。

回答:

您配置的tomcat错误。在您的pom.xml中,添加tomcat插件。(您可以将其用于Tomcat 7和Tomcat 8):

<!-- Tomcat 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>TomcatServer</server> *(From maven > settings.xml)*

<username>*yourtomcatusername*</username>

<password>*yourtomcatpassword*</password>

</configuration>

</plugin>

<tomcat-users>

<role rolename="manager-gui"/>

<role rolename="manager-script"/>

<user username="admin" password="password" roles="manager-gui,manager-script" />

</tomcat-users>

(Maven> conf)

<servers>  

<server>

<id>TomcatServer</id>

<username>admin</username>

<password>password</password>

</server>

</servers>

mvn tomcat7:部署或mvn tomcat7:重新部署

在(Ubuntu和Windows 8/10上)尝试过此操作:* Jdk 7和Tomcat 7 * Jdk 8和Tomcat 7 * Jdk 8和Tomcat

8

尚未在Jdk 7和Tomcat 8上尝试过:)

注意:Tomcat管理器应该正在运行或正确设置,然后才能与maven一起使用。

祝好运!

以上是 Maven Clean在tomcat 1.8的sts中不起作用 的全部内容, 来源链接: utcz.com/qa/409218.html

回到顶部