Tag: maven 2

Maven:将WAR复制到Tomcat的webapps目录

有什么我可以添加到pom.xml,将生成的WAR文件从目标目录复制到我的Tomcat的webapps目录?

何时在Maven中使用MojoExecutionException vs MojoFailureException

AbstractMavenMojo的execute方法声明它抛出了两个exception,MojoExecutionException和MojoFailureException。 投掷或者导致构build停止,并且日志在每种情况下显示几乎相同的消息。 MojoExecutionException的消息是: [INFO] ———————————————————————— [ERROR] BUILD ERROR [INFO] ———————————————————————— [INFO] [exception text] [INFO] ———————————————————————— [INFO] For more information, run Maven with the -e switch [INFO] ———————————————————————— 并且MojoFailureException的消息是: [INFO] ———————————————————————— [ERROR] BUILD FAILURE [INFO] ———————————————————————— [INFO] [exception text] [INFO] ———————————————————————— [INFO] For more information, run Maven with the -e switch [INFO] ———————————————————————— 什么时候应该抛出哪个exception,为什么?

如何排除Maven插件中的依赖?

我有一个需要以下Maven jibx插件的项目: <build> <plugins> <plugin> <groupId>org.jibx</groupId> <artifactId>maven-jibx-plugin</artifactId> <version>1.2.2</version> … </plugin> </plugins> </build> 在jibx插件pom中,有一个xpp3依赖关系,我想从我的项目构build过程中排除(由于某些原因,我不能在我的私有存储库中)。 有没有办法来configuration我的pom.xml(而不是插件pom)来排除依赖关系? 编辑 :我试图从插件pom中删除xpp3依赖项和项目可以被成功地build立,所以我知道依赖不是强制性的。

如何将servlet api添加到我的pom.xml中

如何将servlet API添加到我的项目的pom.xml中 mvnrepository.com有很多servlet API和类似命名的项目,我不知道哪个是正确的。 或者都是好的?

maven中的updatePolicy是如何工作的?

当我在我的maven设置中定义一个updatePolicy ,它会告诉maven应该下载多less个快照文件。 如果我把它设置为总是当然每次下载所有的快照。 我想知道如果我把它设置为每天的默认值或另一个更长的期限会发生什么。 Maven是否仍然检查新版本的快照是否可用,如果是,是否下载,尽pipe政策每天都在说吗? 我正在寻找正确的设置,以避免多余的下载,不要错过一个更新的快照。

使用Maven解压zip内部拉链

我可以通过maven-dependency插件解压zip文件,但是目前我有这个zip文件里面的其他zip文件包含的问题,我也需要解压缩它们。 我怎样才能做到这一点?

Surefire并没有selectJunit 4testing

出于某种原因,我无法获得Maven 2 Surefire插件来执行JUnit 4testing课程。 public class SimpleTest { @org.junit.Test public void simple() { System.out.println("foo"); } } 不过如果我把这个类改成JUnit-3之类的,比如 public class SimpleTest extends junit.framework.TestCase { public void testBar() { System.out.println("bar"); } @org.junit.Test public void simple() { System.out.println("foo"); } } 然后它被执行。 以下是我所做的: 已validationMaven版本:Apache Maven 2.2.1(r801777; 2009-08-06 20:16:01 + 0100) 经过validation的Surefire版本:遵循这个build议 经过validation的Surefire版本:在我的~/.m2/repository/org/apache/maven/surefire检查了Surefire jar,它们都是版本2.4.2或2.4.3 做了一个mvn dependency:tree | grep junit mvn […]

在使用maven构build之后,src / main / resources中的资源未find

你好,我正在使用我的Java应用程序中的src / main / resources的configuration文件。 我正在阅读我的class级,就像这样: new BufferedReader(new FileReader(new File("src/main/resources/config.txt"))); 所以现在我使用mvn assembly:assembly来构build这个maven。 这是在我的pom.xml中的那一点: <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.3</version> <configuration> <finalName>TestSuite</finalName> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>com.some.package.Test</mainClass> </manifest> </archive> </configuration> </plugin> 所以当我运行我的应用程序时,我得到这个错误: src\main\resources\config.txt (The system cannot find the path specified) 但是当我右键点击我的组装jar我可以看到里面,任何人都知道我在做什么错了?

JAVA_HOME受到Maven的影响

我正在使用统一的Maven构build来改造大量现有的Java项目。 由于每个项目都很成熟,并且已经build立了基于Ant的构build,所以我使用maven-antrun-plugin来执行现有的build.xml ,如下所示: <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>compile</phase> <configuration> <tasks> <ant antfile="build.xml" target="compile" /> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> 当我运行mvn compile失败,出现这个消息: [INFO] An Ant BuildException has occured: The following error occurred while executing this line: build.xml:175: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not […]

我如何使用Maven获取最新的Hibernate版本?

我无法通过Maven依赖关系获取最新版本的Hibernate。 看来最新的我可以从Maven中央仓库获取3.2.6.GA,而且我有兴趣使用3.3.2.GA,它是hibernate.org站点上显示的最新版本。 当我在我的项目的pom.xml中将我的hibernate依赖项修改为最新版本时,我运行Maven构build时出现以下错误: Missing: ———- 1) org.hibernate:hibernate:jar:3.3.2.GA Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.hibernate -DartifactId=hibernate -D version=3.3.2.GA -Dpackaging=jar -Dfile=/path/to/file Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=org.hibernate -DartifactId=hibernate -Dve rsion=3.3.2.GA -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[ id] 一旦我这样做,我继续得到错误,指示我需要添加一个javassist依赖项,然后我需要更新我的hibernate-validator依赖项,这也需要本地安装,在那一点上,我停下来,看看周围,看看是否有一个更好的方法,也许可以将Maven指向JBoss […]