I have set up a maven project, which is create a JAR File as artefact. Now I have created some JUnit tests and would like to stop the maven build, if one of these junit test fails. What steps are necessary, to do this? Now I get a JAR File, although one or more JUnit test fails.
I have created my JUnit test in the folder "src/main/resources" und here is the build snippet of my pom.xml:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<optimize>true</optimize>
<fork>true</fork>
<source>${source.jdk}</source>
<target>${target.jdk}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>
jar-with-dependencies
</descriptorRef>
</descriptorRefs>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifestEntries>
<Source-JDK>${source.jdk}</Source-JDK>
<Target-JDK>${target.jdk}</Target-JDK>
<Project-Build-SourceEncoding>${project.build.sourceEncoding}</Project-Build-SourceEncoding>
<Maven-Build-Timestamp>${maven.build.timestamp}</Maven-Build-Timestamp>
</manifestEntries>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>${project.groupId}.${project.artifactId}.myMainFile</mainClass>
</manifest>
</archive>
<appendAssemblyId>false</appendAssemblyId>
<classifier>jar-with-dependencies</classifier>
</configuration>
<executions>
<execution>
<id>assembly-jar-Id</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>