在Maven实际使用过程中,有时候在对一些旧有的项目的做从Makefile和ant到Maven迁移时需要对一些步骤做特殊处理,比如说编译JNI代码,虽然Maven有个native插件可以用,但需要将原有项目JNI的编译步骤重写,这在有些时候显然不太适合,比如时间压力比较大的情况下。其实这种情况可以使用Maven的antrun插件来做,这样做的好处就是可以重用原来写好的Makefile,相对来说还是比较简单也是最快的。具体信息可以参考http://maven.apache.org/plugins/maven-antrun-plugin/。
Maven的antrun用起来也是非常简单的,就是在代码里嵌入类似以下代码片段:
- <build>
<plugins> - <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<configuration>
<target>
<property name="compile_classpath" refid="maven.compile.classpath"/>
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
<property name="test_classpath" refid="maven.test.classpath"/>
<property name="plugin_classpath" refid="maven.plugin.classpath"/> - <ant antfile="${basedir}/build.xml">
<target name="release"/>
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<?xml version="1.0" encoding="UTF-8"?>
<project name="jsdx-dmtp-build" default="release" basedir=".">
<!-- 环境属性文件 -->
<property file="build.properties" />
<target name="release" >
<echo message="-----------构建项目-------------" />
<delete dir="${project.webapp}"/>
<mkdir dir="${project.webapp}"/>
<copy todir="${project.webapp}">
<fileset dir="${maven.webapp}">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${project.webapp}/WEB-INF/classes">
<fileset dir="${basedir}/../maven-m1/target/classes">
<include name="**/*" />
</fileset>
</copy>
</target>
</project>
在构建时,会出现以下错误,was cached in the local repository, resolution will not be reattempted until
该错误是由于插件没有下载成功的原因。
解决方法:删除本地仓库相关插件。
相关推荐
maven-antrun-plugin-3.0.0.jar
maven-antrun-plugin-1.3.jar maven-antrun-plugin-1.3.jar maven-antrun-plugin-1.3.jar
java运行依赖jar包
java运行依赖jar包
官方离线安装包,测试可用。请使用rpm -ivh [rpm完整包名] 进行安装
用谷歌的closure-compiler + maven-antrun-plugin
这样,您可以确保您不会浪费时间在Apache Maven范围之外的东西上。 假设您的问题不存在,请提交该问题的票证。 清楚地描述问题,包括在出现错误时重现的步骤。 确保填写您知道存在问题的最早版本。 在GitHub上分叉...
在apache-maven-3.5.2/conf/setting.xml中加入以下配置即可解决 alimaven aliyun maven http://maven.aliyun.com/nexus/content/repositories/central/ central junit junit Address/ ...
maven-deploy-plugin-2.8.2.jar
maven-plugin-plugin-1.5.2.jar
maven是个项目管理工具,如果我们不告诉它我们的代码要使用什么样的jdk版本编译的话...maven的默认编译使用的jdk版本貌似很低,使用maven-compiler-plugin插件可以指定项目源码的jdk版本,编译后的jdk版本,以及编码。
maven-jar-plugin-3.1.1.jar
Maven使用tomcat8-maven-plugin插件
maven-tomcat-plugin让maven与tomcat配合得很好。它可以把应用部署到Tomcat服务器,也可以把tomcat作为内嵌服务器启动,就像jetty一样。 使用JPDA启动tomcat的远程调试功能。这样就能与eclipse配合起来,轻松地实现...
maven-resources-plugin-2.4.1.jar
maven-clean-plugin-3.1.0.jar
maven-install-plugin-2.4.jar
dockerfile-maven-plugin 支持 maven 直接发布项目至 docker 镜像库
maven-site-plugin-3.3.jar
maven-deploy-plugin-2.7.jar