MVN TEST指定運行腳本


clean:表示將你上一次編譯生成的一些文件刪除

test:表示只執行測試代碼

>mvn clean test -Dtest=[ClassName]

運行測試類中指定的方法:這個需要maven-surefire-plugin 2.7.3以上的版本才能支持

>mvn clean test -Dtest=[ClassName]#[MethodName]

//MethodName為要運行的方法名,支持*通配符

例如:

>mvn test -Dtest=MyClassTest#*test*

 

mvn clean assembly:assembly 生產jar包,在target文件夾下面,在pom.xml中添加下面的插件

可用 java -jar target/xxx.jar main函數參數列表的形式 運行jar包

 

<build>
  <plugins>
  <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
      <finalName>打包后生成的jar包的名字</finalName>
      <appendAssemblyId>false</appendAssemblyId>
      <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>
      <archive>
        <manifest>
          <mainClass>jar包的入口,也就是想要調用的main函數所在的包</mainClass>
        </manifest>
      </archive>
    </configuration>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>single</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  </plugins>
  </build>

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM