Created
February 25, 2013 12:58
-
-
Save hokuma/5029662 to your computer and use it in GitHub Desktop.
テストコードと依存するライブラリをjarにまとめてCLIで実行する ref: http://qiita.com/items/e489d02f9622ce73b235
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
... | |
<plugins> | |
... | |
<plugin> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<version>2.2</version> | |
<executions> | |
<execution> | |
<id>make-assembly</id> | |
<phase>package</phase> | |
<goals> | |
<goal>single</goal> | |
</goals> | |
</execution> | |
</executions> | |
<configuration> | |
<descriptors> | |
<descriptor>src/test/resources/assembly.xml</descriptor> | |
</descriptors> | |
</configuration> | |
</plugin> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> | |
<id>test-jar-with-dependencies</id> | |
<formats> | |
<format>jar</format> | |
</formats> | |
<includeBaseDirectory>false</includeBaseDirectory> | |
<dependencySets> | |
<dependencySet> | |
<outputDirectory>/</outputDirectory> | |
<useProjectArtifact>true</useProjectArtifact> | |
<unpack>true</unpack> | |
<scope>test</scope> | |
</dependencySet> | |
</dependencySets> | |
</assembly> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java -cp 上で作ったjar org.junit.runner.JUnitCore テストが記載されたクラス名 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java -cp smoke-test-0.0.1-SNAPSHOT-test-jar-with-dependencies.jar org.junit.runner.JUnitCore sample.smoketest.SampleSpec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment