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>

 

 

 

posted @ 2018-08-22 21:56  知了.Test  阅读(3140)  评论(0编辑  收藏  举报