如何在安装maven项目时跳过集成测试的编译? 我只找到-DskipITs和-DskipTests但它们只跳过执行而不是编译。 我想删除所需的测试依赖项。
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.example.confluence</groupId>
<artifactId>qspaRest</artifactId>
<packaging>atlassian-plugin</packaging>
<name>qspaRest</name>
<version>3.0.4-SNAPSHOT</version>
<description>REST resources needed by the QSPA backend importer for
* getting meta information from a space (name, description, homepage, permissions, ...)</description>
<build>
<sourceDirectory>/Users/example/git/qsparest/qsparest/src/main/java</sourceDirectory>
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>/Users/example/git/qsparest/qsparest/src/test/java</testSourceDirectory>
<outputDirectory>/Users/example/git/qsparest/qsparest/target/classes</outputDirectory>
<testOutputDirectory>/Users/example/git/qsparest/qsparest/target/test-classes</testOutputDirectory>
<resources>
<resource>
<directory>/Users/example/git/qsparest/qsparest/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>/Users/example/git/qsparest/qsparest/src/test/resources</directory>
</testResource>
</testResources>
<directory>/Users/example/git/qsparest/qsparest/target</directory>
<!-- <finalName>qspaRest-3.0.3-SNAPSHOT</finalName>-->
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<!-- For install:install-file-->
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.1</version>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.4.3</version>
</plugin>
<plugin>
<artifactId>maven-rar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-8</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.0-beta-7</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.0.4</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<!-- delete directories that will be generated when you
start the develpment server/client in eclipse
-->
<fileset>
<directory>target</directory>
<includes>
<include>**/*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-confluence-plugin</artifactId>
<version>3.9</version>
<extensions>true</extensions>
<configuration>
<allowGoogleTracking>false</allowGoogleTracking>
<productVersion>${confluence.version}</productVersion>
<productDataVersion>3.5</productDataVersion>
<productDataPath>${basedir}/src/test/resources/generated-test-resources.zip</productDataPath>
<instructions />
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>atlassian-public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
</repository>
<repository>
<releases>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>atlassian-plugin-sdk</id>
<url>file:///Users/example/Desktop/atlassian-plugin-sdk-3.9/repository</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>atlassian-public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
</pluginRepository>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jwebunit</groupId>
<artifactId>jwebunit-htmlunit-plugin</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.confluence.plugin</groupId>
<artifactId>func-test</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-client</artifactId>
<version>1.1.3-incubating</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<!--
<dependency>
<groupId>de.example</groupId>
<artifactId>qspaBackend</artifactId>
<version>3.0.3-SNAPSHOT</version>
</dependency>
-->
<!-- TODO: There is no separate confluence artifact, so we depend on the complete backend at the moment
-->
<dependency>
<groupId>de.example</groupId>
<artifactId>qspaJiraModel</artifactId>
<version>3.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.example</groupId>
<artifactId>qspaConfluenceModel</artifactId>
<version>3.0.4-SNAPSHOT</version>
</dependency>
<!--
-->
</dependencies>
<reporting>
<outputDirectory>/Users/example/git/qsparest/qsparest/target/site</outputDirectory>
</reporting>
<properties>
<amps.version>3.9</amps.version>
<downloadSources>true</downloadSources>
<confluence.data.version>3.5</confluence.data.version>
<downloadJavadocs>true</downloadJavadocs>
<confluence.version>4.1.4</confluence.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>true</skipTests>
<!-- Settings for install:install-file-->
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>${project.packaging}</packaging>
<file>${project.build.directory}/${project.build.finalName}.jar</file>
</properties>
</project>
答案 0 :(得分:2)
属性-Dmaven.test.skip=true
将跳过所有测试以及所有测试编译,因为它被failsafe,surefire和编译器插件接受。所有其他属性如-DskipTests
只会跳过测试的执行,但文件仍在编译中。