[英]Maven - No plugin found for prefix 'tomcat7' in the current project and in the plugin groups
I've created a Maven project. 我创建了一个Maven项目。 This is the structure:
这是结构:
-parent
-core
-web
but when I try to deploy with the command mvn tomcat7:deploy
, I get the following error: 但是当我尝试使用命令
mvn tomcat7:deploy
,我收到以下错误:
No plugin found for prefix 'tomcat7' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo]
I put this configuration in the pom.xml (of the web project): 我把这个配置放在pom.xml(web项目)中:
<build>
<finalName>MavenWeb</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</build>
Plugins goals can be called using their 'FQN': groupId:artifactId:version:goal or, if applicable, shorter commands (many variants available). 插件目标可以使用他们的'FQN'来调用: groupId:artifactId:version:goal,或者,如果适用,还有更短的命令(可用的许多变体)。 Using only the short name of a plugin (in your tomcat7:deploy , tomcat7 is the short name, deploy being the goal/mojo) is applicable if:
仅使用插件的短名称(在tomcat7:deploy中 ,tomcat7是短名称,deploy为目标/ mojo)适用于:
1) the groupId of the plugin is contained in the known plugin groups of Maven. 1)插件的groupId包含在Maven的已知插件组中。 org.apache.maven.plugins being in the list by default.
org.apache.maven.plugins默认位于列表中。
OR 要么
the pom.xml of the project you're invoking the Maven command on declares the plugin 你正在调用Maven命令的项目的pom.xml声明了插件
2) the artifactId is [short-name]-maven-plugin or maven-[short-name]-plugin ( maven-[short-name]-plugin being 'reserved' for plugins provided by Maven project. 2)artifactId是[短名称] -maven-plugin或maven- [short-name] -plugin ( maven- [short-name] -plugin被'保留'为Maven项目提供的插件。
That explains why mvn compiler:compile can work out of the box on any project, but not tomcat7:deploy 这就解释了为什么mvn compiler:compile可以在任何项目上开箱即用,但不能在tomcat7:deploy中运行
In your case, the second condition is true, so you just have to declare the plugin on the project you're launching the command on, or add this to your user settings.xml file: 在您的情况下,第二个条件为true,因此您只需在要启动命令的项目上声明插件,或将其添加到您的user settings.xml文件中:
<pluginGroups>
<pluginGroup>org.apache.tomcat.maven</pluginGroup>
</pluginGroups>
The reason why you get that error is because you simply have not installed the Tomcat7 plugin. 您收到该错误的原因是您没有安装Tomcat7插件。 Here's what you can do (I tested this on my test project and it works):
这是你可以做的(我在我的测试项目中测试了它并且它有效):
pom.xml
file just like you have done. pom.xml
文件中添加tomcat7插件依赖项。 mvn install
or mvn package
to install that tomcat7 plugin mvn install
或mvn package
来安装该tomcat7插件 mvn tomcat7:deploy
mvn tomcat7:deploy
I tested this solution with mvn tomcat7:run
and it works like a charm :) 我用
mvn tomcat7:run
测试了这个解决方案mvn tomcat7:run
它就像魅力:)
It means tomcat7 plugin not found . 这意味着找不到tomcat7插件。 Add this to your pom.xml.
将其添加到您的pom.xml中。
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
</plugin>
</plugins>
</build>
The error happens to have the plugin inside <reporting>
, it should be located in <build>
错误恰好在
<reporting>
包含插件,它应该位于<build>
Before: 之前:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8080</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</reporting>
After: 后:
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8080</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
在检查了我的pom.xml文件之后,我确保在JAVA Build Path JAVA BUILD PATH下的构建顺序中选择了所有依赖项。
I got the same error from using the file based idp.xml and formatting it!!! 我使用基于文件的idp.xml并格式化它得到了同样的错误! Don't format it, use curl, or chrome and save the file from https://idp.ssocircle.com/idp-meta.xml directly to spring-security-saml-1.0.2.RELEASE\\sample\\src\\main\\resources\\metadata\\idm.xml
不要格式化,使用curl或chrome并将文件从https://idp.ssocircle.com/idp-meta.xml直接保存到spring-security-saml-1.0.2.RELEASE \\ sample \\ src \\ main \\资源\\元\\ idm.xml
Then in SecurityContext.cml 然后在SecurityContext.cml中
<bean id="metadata" class="org.springframework.security.saml.metadata.CachingMetadataManager">
<constructor-arg>
<list>
<!-- Example of classpath metadata with Extended Metadata -->
<bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate">
<constructor-arg>
<bean class="org.opensaml.saml2.metadata.provider.ResourceBackedMetadataProvider">
<constructor-arg>
<bean class="java.util.Timer"/>
</constructor-arg>
<constructor-arg>
<bean class="org.opensaml.util.resource.ClasspathResource">
<constructor-arg value="/metadata/idp.xml"/>
</bean>
</constructor-arg>
<property name="parserPool" ref="parserPool"/>
</bean>
</constructor-arg>
<constructor-arg>
<bean class="org.springframework.security.saml.metadata.ExtendedMetadata">
</bean>
</constructor-arg>
</bean>
</bean>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.