Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>test-jar</id>
- <phase>test-compile</phase>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <dependency>
- <groupId>com.example</groupId>
- <artifactId>foo</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- <profile>
- <id>local</id>
- <dependencies>
- <dependency>
- <groupId>com.example</groupId>
- <artifactId>foo</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <type>test-jar</type>
- </dependency>
- </dependencies>
- </profile>
- <execution>
- <id>local-build</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>batman</classifier>
- <directory>${basedir}/src/test/java</directory> <!-- tried several variations here -->
- <includes>
- <include>**</include>
- </includes>
- </configuration>
- </execution>
- <project>
- <groupId>com.example</groupId>
- <artifactId>foo</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <build>
- <plugins>
- ...
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <dependency>
- <groupId>com.example</groupId>
- <artifactId>foo</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <type>test-jar</type>
- <!-- uncomment if needed in test scope only
- <scope>test</scope>
- -->
- </dependency>
- <dependency>
- <groupId>com.example</groupId>
- <artifactId>foo</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <!-- used to package the dummy daos when building
- with the local profile -->
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${extra.sources.dir}</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <profile>
- <id>local</id>
- <properties>
- <env.resources.dir>src/test/resources</env.resources.dir>
- <extra.sources.dir>src/test/java</extra.sources.dir>
- </properties>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.test</artifactId>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </profile>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>compile</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes>
- <include>com.example:foo</include>
- </includes>
- </artifactSet>
- <outputDirectory>target/dependencies</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement