<!-- package: mvn -Dtest -DfailIfNoTests=false -e package -->
<!-- install: mvn -Dtest -DfailIfNoTests=false -e install -->
<!-- deploy: mvn deploy:deploy-file -Dfile=basedomain.jar -Durl=dav:http://localhost:8081/artifactory/repo1/ -DpomFile=pom.xml -->
注意:http://localhost:8081/artifactory/repo/要写成http://localhost:8081/artifactory/repo1/
<!--mvn source:jar 打包源代码-->
<!--mvn source:test-jar 把测试包中的源代码也打包-->
<plugin>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>package</phase> <!--设置打包的阶段,此处是在package阶段打包-->
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
对资源文件的处理:
<build>
<finalName>dvteboss</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
<build>
<finalName>dvteboss</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*.prop</include>
</includes>
</resource>
</resources>
</build>
这样配置的话,maven会在src/main/resources下面去找.prop的文件并打包,其它格式的文件就被过滤到了,但这个目录下面并没有这样的文件,从而达到过滤到全部资源文件的目的。
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
</plugins>