groovy入门(2-1)Groovy的Maven插件安装:Plugin execution not covered by lifecycle configuration
2017-06-30 19:21
671 查看
参考链接:http://www.cnblogs.com/rightmin/p/4945797.html
1、引入groovy的jar包
2、引入groovy编译插件
3、遇到问题 Plugin execution not covered by lifecycle configuration
4、解决办法
quickfix+删除重导入工程大法!!下面是网上介绍的解决方法,下次遇到再试试:
5、附录代码 - eclipse开发Groovy代码,与java集成,maven打包编译
5.1、设置类路径 src/main/groovy
maven工程的java代码一般是这么放的 src/main/java/com.xxx.xxx而我们的groovy的代码可以这么放,并把这个目录设置为classpath, src/main/groovy/com.xxx.xxx
5.2、测试程序HelloWorld.groovy
写一个hello world程序,创建的工程不是Groovy Project,所以这个文件eclipse是不认识的,会报错,不过只需要引入Groovy的相关jar就可以识别了class AppGroovy {
static main(args) {
def closure = { param -> println "hello ${param}" }
closure("world")
}
}
5.3、引入pom依赖jar包
pmo.xml里面加入Groovy的引用<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.7</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.2-01</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.4.3-01</version>
</dependency>
5.4、引入pom依赖 编译插件
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.7.0-01</version>
</dependency>
</dependencies>
</plugin>
这样,上面那个Groovy类就可以被编译和识别了
5.5、编译运行
mvn package就可以打包进去了!!运行方法:右键Groovy文件,Run As -> Groovy Sctipt
如果要嵌入Java类中也很简单,直接在java里面引用就好了
public class App {
public static void main(String[] args) {
AppGroovy.main(args);
}
}
运行方法:右键Java文件,Run As -> Java Application
相关文章推荐
- maven插件异常:Plugin execution not covered by lifecycle configuration
- 备忘:maven 错误信息: Plugin execution not covered by lifecycle configuration
- Maven在导入其他项目时报错:Plugin execution not covered by lifecycle configuration
- Maven项目:Plugin execution not covered by lifecycle configuration 解决方案
- 修复 Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.8:add-source (execution: add-source, phase: generate-sources)
- Maven项目:Plugin execution not covered by lifecycle configuration 解决方案
- Eclipse Maven报错:Plugin execution not covered by lifecycle configuration
- maven的Plugin execution not covered by lifecycle configuration解决办法
- 在POM配置Maven plugin提示错误“Plugin execution not covered by lifecycle configuration”的解决方案
- 解禁 MAVEN “Plugin execution not covered by lifecycle configuration” 问题
- 在POM配置Maven plugin提示错误“Plugin execution not covered by lifecycle configuration”的解决方案
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugi
- 解决 在POM配置Maven plugin提示错误“Plugin execution not covered by lifecycle configuration”
- eclipse maven plugin execution not covered by life cycle configuration
- Plugin execution not covered by lifecycle configuration: aspectj-maven-plugin:1.8
- Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin
- Maven Plugin execution not covered by lifecycle configuration
- 备忘:maven 错误信息: Plugin execution not covered by lifecycle configuration
- Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:xml-maven-plugin:1.0:tran
- MyEclipse导入Maven项目报错 Plugin execution not covered by lifecycle configuration: