我尝试将tomcat7插件用于maven。我使用的是Maven 2.2.1和Java 1.7。我将插件包含在我的pom.xml中,如下所示:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
当我尝试运行mvn tomcat7:run&#39;时,我收到此错误:
The plugin 'org.apache.maven.plugins:maven-tomcat7-plugin' does not exist or no valid version could be found
我从〜/ .2m删除了我的本地存储库,以确保没有任何错误。还设置了nox代理等。当我尝试用“mtn tomcat7:run -X -U&#39;”来深入研究这个时,我得到了这个痕迹:
错误堆栈跟踪已打开。 Apache Maven 2.2.1(rdebian-14)Java版本:1.7.0_65 Java home:/ usr / lib / jvm / java-7-oracle / jre 默认语言环境:en_US,平台编码:UTF-8操作系统名称:&#34; linux&#34; 版本:&#34; 3.13.0-32-generic&#34; arch:&#34; amd64&#34;家庭:&#34; unix&#34; [DEBUG] 从以下位置构建Maven用户级插件注册表: &#39; /home/brost/.m2/plugin-registry.xml' [DEBUG]建造Maven 全局级插件注册表来自: &#39; /usr/share/maven2/conf/plugin-registry.xml' [信息]正在扫描 projects ... [DEBUG]为。添加托管依赖项 com.google.gwt:gwt-user:jar:2.6.1:提供[DEBUG]
com.google.gwt:gwt-servlet:jar:2.6.1 [DEBUG]
com.google.gwt:gwt-dev:jar:2.6.1:test [DEBUG]
javax.servlet:javax.servlet-api:jar:3.0.1:提供[DEBUG]
com.gwtplatform:gwtp-all:jar:1.3 [DEBUG]
com.google.inject:guice:jar:3.0 [DEBUG]
com.google.inject.extensions:guice-servlet:jar:3.0 [DEBUG]
com.google.inject.extensions:guice-assistedinject:jar:3.0 [DEBUG]
com.google.gwt.inject:gin:jar:2.1.2 [DEBUG]
com.lambdaworks:scrypt:jar:1.4.0 [DEBUG] junit:junit:jar:4.7:test [DEBUG] org.jukito:jukito:jar:1.4:test [DEBUG]
org.hibernate:hibernate-entitymanager:jar:4.3.5.Final [DEBUG]
org.hsqldb:hsqldb:jar:2.3.2 [DEBUG]
org.slf4j:slf4j-log4j12:jar:1.7.7:提供[DEBUG]
com.allen-sauer.gwt.log:gwt-log:jar:3.3.0 [DEBUG]添加托管 未知的依赖关系:mdm-client [DEBUG]
com.google.gwt:gwt-user:jar:2.6.1:提供[DEBUG]
com.google.gwt:gwt-servlet:jar:2.6.1 [DEBUG]
com.google.gwt:gwt-dev:jar:2.6.1:test [DEBUG]
javax.servlet:javax.servlet-api:jar:3.0.1:提供[DEBUG]
com.gwtplatform:gwtp-all:jar:1.3 [DEBUG]
com.google.inject:guice:jar:3.0 [DEBUG]
com.google.inject.extensions:guice-servlet:jar:3.0 [DEBUG]
com.google.inject.extensions:guice-assistedinject:jar:3.0 [DEBUG]
com.google.gwt.inject:gin:jar:2.1.2 [DEBUG]
com.lambdaworks:scrypt:jar:1.4.0 [DEBUG] junit:junit:jar:4.7:test [DEBUG] org.jukito:jukito:jar:1.4:test [DEBUG]
org.hibernate:hibernate-entitymanager:jar:4.3.5.Final [DEBUG]
org.hsqldb:hsqldb:jar:2.3.2 [DEBUG]
org.slf4j:slf4j-log4j12:jar:1.7.7:提供[DEBUG]
com.allen-sauer.gwt.log:gwt-log:jar:3.3.0 [DEBUG]添加托管 未知的依赖关系:mdm-shared [DEBUG]
com.google.gwt:gwt-user:jar:2.6.1:提供[DEBUG]
com.google.gwt:gwt-servlet:jar:2.6.1 [DEBUG]
com.google.gwt:gwt-dev:jar:2.6.1:test [DEBUG]
javax.servlet:javax.servlet-api:jar:3.0.1:提供[DEBUG]
com.gwtplatform:gwtp-all:jar:1.3 [DEBUG]
com.google.inject:guice:jar:3.0 [DEBUG]
com.google.inject.extensions:guice-servlet:jar:3.0 [DEBUG]
com.google.inject.extensions:guice-assistedinject:jar:3.0 [DEBUG]
com.google.gwt.inject:gin:jar:2.1.2 [DEBUG]
com.lambdaworks:scrypt:jar:1.4.0 [DEBUG] junit:junit:jar:4.7:test [DEBUG] org.jukito:jukito:jar:1.4:test [DEBUG]
org.hibernate:hibernate-entitymanager:jar:4.3.5.Final [DEBUG]
org.hsqldb:hsqldb:jar:2.3.2 [DEBUG]
org.slf4j:slf4j-log4j12:jar:1.7.7:提供[DEBUG]
com.allen-sauer.gwt.log:gwt-log:jar:3.3.0 [DEBUG]添加托管 未知的依赖关系:mdm-server [DEBUG]
com.google.gwt:gwt-user:jar:2.6.1:提供[DEBUG]
com.google.gwt:gwt-servlet:jar:2.6.1 [DEBUG]
com.google.gwt:gwt-dev:jar:2.6.1:test [DEBUG]
javax.servlet:javax.servlet-api:jar:3.0.1:提供[DEBUG]
com.gwtplatform:gwtp-all:jar:1.3 [DEBUG]
com.google.inject:guice:jar:3.0 [DEBUG]
com.google.inject.extensions:guice-servlet:jar:3.0 [DEBUG]
com.google.inject.extensions:guice-assistedinject:jar:3.0 [DEBUG]
com.google.gwt.inject:gin:jar:2.1.2 [DEBUG]
com.lambdaworks:scrypt:jar:1.4.0 [DEBUG] junit:junit:jar:4.7:test [DEBUG] org.jukito:jukito:jar:1.4:test [DEBUG]
org.hibernate:hibernate-entitymanager:jar:4.3.5.Final [DEBUG]
org.hsqldb:hsqldb:jar:2.3.2 [DEBUG]
org.slf4j:slf4j-log4j12:jar:1.7.7:提供[DEBUG]
com.allen-sauer.gwt.log:gwt-log:jar:3.3.0 [INFO] Reactor构建顺序: 在存储库中搜索带有前缀的插件:&#39; tomcat7&#39;。 [DEBUG] 从组加载插件前缀:org.apache.maven.plugins [INFO] org.apache.maven.plugins:从中央[DEBUG]检查更新 从默认映射中使用Wagon实现轻量级 protocol http [DEBUG]检查预先存在的User-Agent 组态。 [DEBUG]添加User-Agent配置。 [DEBUG] 连接到存储库:&#39; central&#39;用url: &#39; http://repo1.maven.org/maven2&#39 ;. [DEBUG]使用Wagon实施 来自协议http [DEBUG] Loading的默认映射的轻量级 来自group的插件前缀:org.codehaus.mojo [INFO] org.codehaus.mojo:检查来自中央[DEBUG]的更新 Wagon实现轻量级从协议的默认映射 http [DEBUG]检查预先存在的User-Agent配置。 [DEBUG]添加User-Agent配置。 [DEBUG]正在连接 存储库:&#39; central&#39;使用网址:&#39; http://repo1.maven.org/maven2&#39;。 [DEBUG]从默认映射中使用Wagon实现轻量级 用于协议http [INFO]工件 org.apache.maven.plugins:maven-tomcat7-plugin:检查更新 来自中央[DEBUG]使用Wagon实现轻量级 协议http的默认映射[DEBUG]检查预先存在的 用户代理配置。 [DEBUG]添加User-Agent配置。 [DEBUG]连接到存储库:&#39; central&#39;用url: &#39; http://repo1.maven.org/maven2&#39 ;. [DEBUG]使用Wagon实施 来自协议http [DEBUG]存储库的默认映射的轻量级 元数据:&#39; artifact org.apache.maven.plugins:maven-tomcat7-plugin&#39; 无法在存储库中找到:central [DEBUG] maven-tomcat7-plugin:使用本地安装的快照[DEBUG] 未找到工件 - 使用存根模型:无法确定最新 版本org.apache.maven.plugins:行家-tomcat7-插件:POM:最新
[DEBUG]使用缺省POM的默认值 org.apache.maven.plugins:maven-tomcat7-plugin:pom:LATEST [DEBUG] maven-tomcat7-plugin:使用本地安装的快照[DEBUG] 未找到工件 - 使用存根模型:无法确定发布 版本
org.apache.maven.plugins:行家-tomcat7-插件:POM:RELEASE
[DEBUG]使用缺省POM的默认值 org.apache.maven.plugins:maven-tomcat7-plugin:pom:RELEASE [INFO] -------------------------------------------------- ---------------------- [错误]建立错误[信息] -------------------------------------------------- ---------------------- [INFO]插件&#39; org.apache.maven.plugins:maven-tomcat7-plugin&#39;不 不存在或找不到有效版本[INFO] -------------------------------------------------- ---------------------- [DEBUG]跟踪org.apache.maven.lifecycle.LifecycleExecutionException: 插件&#39; org.apache.maven.plugins:maven-tomcat7-plugin&#39;才不是 存在或无法找到有效版本 org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1569) 在 org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851) 在 org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462) 在 org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175) 在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:606)at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) 在org.codehaus.classworlds.Launcher.launch(Launcher.java:255)at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) 在org.codehaus.classworlds.Launcher.main(Launcher.java:375)引起 by:org.apache.maven.plugin.version.PluginVersionNotFoundException: 插件&#39; org.apache.maven.plugins:maven-tomcat7-plugin&#39;才不是 存在或无法找到有效版本 org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:229) 在 org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:91) 在 org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:179) 在 org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642) 在 org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540) ......还有15个
但是可以肯定的是,插件可以在maven存储库中找到here。
我们在pom.xml中定义了三个子模块。但如果我删除它们,错误仍然是相同的。所以这不应该与底层的pom.xml文件有关。
我可以做些什么来进一步调试?
编辑:这是完整的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>testproject</groupId>
<artifactId>mdm</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<prerequisites>
<maven>${mavenVersion}</maven>
</prerequisites>
<properties>
<!-- client -->
<gwt.version>2.6.1</gwt.version>
<gwtp.version>1.3</gwtp.version>
<gin.version>2.1.2</gin.version>
<gwt-maven-plugin.version>2.6.1</gwt-maven-plugin.version>
<!-- server -->
<guice.version>3.0</guice.version>
<!-- testing -->
<junit.version>4.7</junit.version>
<jukito.version>1.4</jukito.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<!-- GWT-Platform -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-all</artifactId>
<version>${gwtp.version}</version>
</dependency>
<!-- DI -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>${gin.version}</version>
</dependency>
<!-- Password Hashing scrypt -->
<dependency>
<groupId>com.lambdaworks</groupId>
<artifactId>scrypt</artifactId>
<version>1.4.0</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jukito</groupId>
<artifactId>jukito</artifactId>
<version>${jukito.version}</version>
<scope>test</scope>
</dependency>
<!-- Hibernate -->
<!-- for JPA, use hibernate-entitymanager instead of hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.5.Final</version>
</dependency>
<!-- hSQLDB -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.2</version>
</dependency>
<!-- Server Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
<scope>provided</scope>
</dependency>
<!-- GWT-Log -->
<dependency>
<groupId>com.allen-sauer.gwt.log</groupId>
<artifactId>gwt-log</artifactId>
<version>3.3.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.1.v20140609</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.6.1</version>
<configuration>
<deploy>${project.build.directory}/gwtc/extra</deploy>
<extra>${project.build.directory}/gwtc/extra</extra>
<gen>${project.build.directory}/gwtc/gen</gen>
<!-- There's an issue on Mac: see http://code.google.com/p/google-web-toolkit/issues/detail?id=7474
<workDir>${project.build.directory}/gwtc/work</workDir> <codeServerWorkDir>${project.build.directory}/gwtc/superDevMode</codeServerWorkDir> -->
</configuration>
<executions>
<execution>
<id>gwt-compile</id>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
答案 0 :(得分:0)
pom.xml
看起来像是一个错误。您可能忘记在<build>
部分中包含插件的组ID,这会使maven采用默认/自动组ID org.apache.maven.plugins
它应该是这样的:
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
...