我在Mac 10.6.6上使用Maven 3.0.3.我有一个JAR项目,当我运行命令"mvn clean install:install"时,我收到错误,
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-cli) on project StarTeamCollisionUtil: The packaging for this project did not assign a file to the build artifact -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
这是什么意思,我该如何解决?下面是我的pom.xml.让我知道其他信息会有所帮助,我会编辑这篇文章.谢谢, - 戴夫
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myco.starteam.util</groupId>
<artifactId>StarTeamCollisionUtil</artifactId>
<packaging>jar</packaging>
<name>StarTeam Collision Util</name>
<description>
The StarTeam Collision Utility provides developers and release engineers alike the ability to
compare files attached to a set of CRs to see if conflicts exist in the change set.
</description>
<version>1.0-SNAPSHOT</version> …Run Code Online (Sandbox Code Playgroud) 相对较新的开发人员,尽管我已经使用了一段时间,但我希望能够巩固我的Maven基础知识.我的一部分问题是我没有使用Ant的经验,这似乎来自许多解释的起源.我一直在阅读和观看教程,我一直听到相同的条款:
从我所学到的,似乎生命周期是最广泛的,并且由阶段,插件和/或目标组成(或完成).
问题:您能否提供有关这些术语如何相关的任何信息以及最常见的示例?
越明确,越基本越好!
我在STS中看到一个错误,我不确定如何调试它.搜索我只看到错误的模糊引用,没有解决方案.
错误是:
org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration)pom.xml/<maven projectName>第1行Maven配置问题
问题:任何人都可以就如何获得有关该问题的更多信息提出任何建议,以便进一步调试或任何可能的解决方案?
可能还有一些关于方法功能的更多背景信息.与该MavenArchiver.getManifest()方法关联的javadoc 不是非常详细,我看不到堆栈跟踪.我已经尝试过几次刷新和更新项目和相关项目,包括清除我当地的m2回购.
STS信息:
m2e信息:
截至今天,我的maven编译失败了.
[INFO] [ERROR] Unexpected
[INFO] java.lang.OutOfMemoryError: Java heap space
[INFO] at java.util.Arrays.copyOfRange(Arrays.java:2694)
[INFO] at java.lang.String.<init>(String.java:203)
[INFO] at java.lang.String.substring(String.java:1877)
Run Code Online (Sandbox Code Playgroud)
[错误]内存不足; 要增加内存量,请在启动时使用-Xmx标志(java -Xmx128M ...)
截至昨天,我已成功运行maven编译.
截至今天,我刚刚把我的堆增加到3 GB.另外,我只更改了2-3行代码,所以我不明白这个"内存不足"的错误.
vagrant@dev:/vagrant/workspace$ echo $MAVEN_OPTS
-Xms1024m -Xmx3000m -Dmaven.surefire.debug=-Xmx3000m
Run Code Online (Sandbox Code Playgroud)
编辑:我通过更改失败的模块的pom.xml尝试了海报的评论.但我得到了相同的maven构建错误.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<fork>true</fork>
<meminitial>1024m</meminitial>
<maxmem>2024m</maxmem>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我希望我的Maven构建版能够运行大多数单元测试.但是在一个项目中有单元测试速度较慢,我想一般排除它们; 并偶尔打开它们.
问题:我该怎么做?
我知道-Dmaven.test.skip=true,但这关闭了所有单元测试.
我也知道跳过集成测试,这里描述.但我没有集成测试,只有单元测试,我没有任何显式调用maven-surefire-plugin.(我正在使用带有Eclipse-Maven插件的Maven 2).
我刚开始使用Maven,我读到插件是可以使用的附加组件.
典型的pom.xml文件结构是
<project>
<groupId>org.koshik.javabrains</groupId>
<artifactId>JarName</artifactId> (A fldernamed JarName was created)
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JarName</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
问题:我应该在哪里插入plugin标签?如下:
<plugin>
<groupId>org.jibx</groupId>
<artifactId>jibx-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<goals>
<goal>bind</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
在依赖之前还是在dependency标记之后?有关系吗?
我正在尝试使用Maven将我的测试类打包到一个带有依赖项的可执行jar中,但我很难做到这一点.
到目前为止这是我的pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.c0deattack</groupId>
<artifactId>executable-tests</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>executable-tests</name>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>cucumber-tests</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>cucumber.cli.Main</mainClass>
</transformer>
</transformers>
<artifactSet>
<includes>
<include>info.cukes:*</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.c0deattack</groupId>
<artifactId>executable-tests</artifactId>
<version>1.0</version>
<type>test-jar</type>
</dependency>
</dependencies>
</plugin> …Run Code Online (Sandbox Code Playgroud) 在Maven项目中,我在同一个包中有测试类和源类,但是在不同的物理位置.
.../src/main/java/package/** <-- application code
.../src/test/java/package/** <-- test code
Run Code Online (Sandbox Code Playgroud)
访问测试类中的源类没有问题,但是我想在main方法中运行一个测试运行器并访问它,AllTest.class以便我可以创建jar并执行我的测试.
public static void main(String[] args) {
// AllTest not found
Result result = JUnitCore.runClasses(AllTest.class);
for (Failure failure : result.getFailures()) {
System.out.println(failure.toString());
}
System.out.println(result.wasSuccessful());
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为我无法访问测试代码.我不明白,因为他们在同一个包中.
问题:如何从应用程序类访问测试类?或者,Maven如何打包包含测试类和执行测试的胖罐?
我有一个pom与以下GAV
<groupId>com.company.services</groupId>
<artifactId>test-branch-2</artifactId>
<version>1.0.21-SNAPSHOT</version>
Run Code Online (Sandbox Code Playgroud)
我想-SNAPSHOT在批处理模式下使用maven 从中删除,所以我可以使用Jenkins来完成,而不必手动指定任何内容.
我查看了版本的文档:set但是所有选项都为我提供了一个交互式提示,并要求我输入版本的名称.
我更喜欢版本插件,而不是发布插件.
pom.xml maven-3 maven maven-release-plugin versions-maven-plugin
如果我们考虑以下示例,"+ - "和"\ - "符号之间的区别是什么,它们表示什么?
[INFO] [dependency:tree]
[INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
[INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile
[INFO] | \- commons-validator:commons-validator:jar:1.2.0:compile
[INFO] | \- commons-digester:commons-digester:jar:1.6:compile
[INFO] | \- (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0)
[INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile
[INFO] \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile
[INFO] \- commons-collections:commons-collections:jar:2.0:compile
Run Code Online (Sandbox Code Playgroud) dependency-management maven maven-dependency-plugin maven-dependency
maven ×10
maven-3 ×7
pom.xml ×5
java ×3
unit-testing ×2
dependencies ×1
eclipse ×1
junit ×1
m2e ×1
maven-2 ×1
maven-plugin ×1