1. 程式人生 > >maven中如何打包原始碼

maven中如何打包原始碼

1、The source plugin can be used to create a jar file of the project sources from the command line or by binding the goal to the project's build lifecycle. To generate the jar from the command line, use the following command:

  A jar file of the test sources can also be generated by executing:
執行後會在target目錄中找到生成的原始檔jar包。 2、在pom.xml中新增:
配置中指定了phase為compile,意思是在生命週期compile的時候就將原始檔打包,即只要執行的mvn命令包括compile這一階段,就會將原始碼打包。同樣,phase還可以指定為package、install等等。