我正在构建一个插件来进行代码生成.
我按照这里的步骤来了解如何创建插件:http: //maven.apache.org/guides/plugin/guide-java-plugin-development.html
插件来源:
/**
* @goal helloworld
* @phase generate-sources
*/
public class SampleMojo extends AbstractMojo
{
@Override
public void execute() throws MojoExecutionException, MojoFailureException
{
getLog().info("Hello, world.");
}
}
Run Code Online (Sandbox Code Playgroud)
用法:
<plugins>
<plugin>
<groupId>com.sample</groupId>
<artifactId>sample-maven-plugin</artifactId>
<version>0.0.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>helloworld</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
该插件本身可以正常工作,但在Eclipse中,我一直得到"生命周期未涵盖"的错误.
我阅读了"如何解决"插件执行未被生命周期配置"Spring Data Maven Builds"所涵盖的内容,我认为如果我创建了自己的插件并设置了@phase和@goal注释,它将摆脱该错误.我真的不想在pom中放入"lifecycleMappingMetadata"节点.
有人对此有任何建议吗?我需要为m2e编写一些特殊内容才能让错误消失吗?
我正在尝试使用wsimportmaven build中声明的目标来使用web服务.但我正面临着这个问题m2e connectors.我的POM中有一个错误
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:jaxws-maven-
plugin:1.10:wsimport (execution: default, phase: generate-sources)
Run Code Online (Sandbox Code Playgroud)
我一直在尝试安装m2e连接器,但即使在市场上也没有.还有其他m2e连接器,但不是我需要的JAX-WS.
我已经关注并尝试了几乎所有这里提到的解决方案,但都是徒劳的.
虽然生成资源没有问题.资源是在构建时成功生成的,但是这个POM错误不允许我的项目与我的tomcat同步,每次我必须手动部署war来测试我做的一些小改动.
这一切真的很烦人,我需要找到解决方案.我在这里使用eclipse juno.下面是我正在使用的POM文件
<build>
<finalName>home</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<phase>post-clean</phase>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<!-- -->
<configuration>
<wsdlUrls>
<wsdlUrl>http://localhost:8080/email-service/services/EmailService?wsdl</wsdlUrl>
</wsdlUrls>
<sourceDestDir>${project.build.directory}/generated</sourceDestDir>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>additional-resources</id> …Run Code Online (Sandbox Code Playgroud) 我在Eclipse中有一个Maven项目,如果我尝试运行,Maven > Update project我会收到以下错误
无法转移org.apache.maven.plugins:来自http://repo.maven.apache.org/maven2的 maven-resources-plugin:pom:2.5 被缓存在本地存储库中,在更新间隔之前不会重新尝试解析中心已经过去或强制更新.原始错误:无法传输工件org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central(http://repo.maven.apache.org/maven2):java.net.ConnectException:连接超时到http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom
mvn eclipse:eclipse在控制台完美.父母POM是
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
Run Code Online (Sandbox Code Playgroud)
任何人都知道为什么?
春天的开始
背景:到目前为止,我一直在研究核心 JAVA,现在我需要切换到 MVC
尝试从本教程制作我的第一个 Spring MVC Hello World 示例 ,我遇到以下错误: pom.xml
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:
2.3.2:compile (execution: default-compile, phase: compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:
2.5:testResources (execution: default-testResources, phase: process-test-resources)
- <packaging>war</packaging>
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:
2.5:resources (execution: default-resources, phase: process-resources)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:
2.3.2:testCompile (execution: default-testCompile, phase: test-compile)
Run Code Online (Sandbox Code Playgroud)
在 …
后续问题的后续: Maven在测试阶段之前运行类:exec-maven-plugin exec:java不执行类.
我在jenkins盒子上运行jUnit4测试,用maven构建.我需要在构建的测试阶段之前运行特定的main方法java程序.目的是在测试运行之前恢复测试数据库.
如果我运行了这个exec分配给的确切阶段,我的类按预期执行; 但是当我运行整个构建时,我的类不会执行:
具体来说,它运行:
mvn -X exec:java generate-test-resources
但不运行:
mvn -X -e install
- 或 -
mvn -X -e clean install
pom.xml: 我的pom.xml文件包括:
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>build-test-environment</id>
<phase>generate-test-resources</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>main.java._tools.BuildTestEnvironment</mainClass>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Run Code Online (Sandbox Code Playgroud)
生命周期默认: 我还没有看到maven的生命周期.日志将其报告为:
[DEBUG] Lifecycle default -> [
validate,
initialize,
generate-sources,
process-sources,
generate-resources,
process-resources,
compile,
process-classes,
generate-test-sources,
process-test-sources,
generate-test-resources,
process-test-resources,
test-compile,
process-test-classes,
test,
prepare-package,
package, …Run Code Online (Sandbox Code Playgroud) 我的pom.xml中出现错误,说:
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.4:add-source (execution: add-generated-sources, phase: process-sources)
Run Code Online (Sandbox Code Playgroud)
这是我的pom.xml的摘录:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-generated-sources</id>
<phase>process-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/entitygenerator</source>
<source>${basedir}/src/main/groovy</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
错误在<execution>标签上.
现在,我很难找到需要Eclipse的插件,但不知何故,我无法找到它.你能帮我吗?
我在Windows XP SP3上使用Eclipse Indigo和Maven 3.0.3,JDK 1.6_22.
我正在查看“spring-mvc-showcase”项目——Spring 仪表板上的一个示例。它是 Github 上的一个——现在下载到我的磁盘上。
我收到以下错误:
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.2:compile (execution: default, phase: process-sources)
Run Code Online (Sandbox Code Playgroud)
到 pom.xml 文件中的这个标签。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<!-- Have to use version 1.2 since version 1.3 does not appear to work with ITDs -->
<version>1.2</version>
....
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
....
Run Code Online (Sandbox Code Playgroud)
包中的其他任何地方都没有其他错误——除了对导入的未使用 API 的一些警告。
这是版本问题吗,我的 Maven 安装有问题......?我正在运行最新版本的 Maven。
这是一个快速修复的请求。对 Maven 不好,对整个 MVC 框架来说是新的,并且已经发出警告。
maven ×7
eclipse ×4
java ×4
m2e ×4
spring ×2
eclipse-juno ×1
groovy ×1
jenkins ×1
maven-plugin ×1
pom.xml ×1
spring-mvc ×1
wsimport ×1