项目打成jar包

时间:2022-03-26 09:40:43
distributionManagement 为发布到本地参考的地址
repository 设置从本地maven库拉取jar包

 

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation
="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.abc.test</groupId>
<artifactId>aaa-bbb-ccc</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>

<name>fcbox-ad-test</name>
<url>http://maven.apache.org</url>

<properties>
<version.dubbo>2.5.3</version.dubbo>
<version.zookeeper>3.4.8</version.zookeeper>
<version.zkclient>0.8</version.zkclient>
<version.spring>4.3.4.RELEASE</version.spring>
<version.javasist>3.20.0-GA</version.javasist>
<version.compiler.plugin>2.4</version.compiler.plugin>
<version.clean.plugin>2.5</version.clean.plugin>
<version.compiler.plugin>2.4</version.compiler.plugin>
<version.deploy.plugin>2.7</version.deploy.plugin>
<version.install.plugin>2.3.1</version.install.plugin>
<version.jar.plugin>2.4</version.jar.plugin>
<version.source.plugin>2.2</version.source.plugin>
<version.resources.plugin>2.6</version.resources.plugin>
</properties>

<dependencies>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.compiler.plugin}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<optimize>true</optimize>
<encoding>utf-8</encoding>
<debug>true</debug>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${version.clean.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${version.deploy.plugin}</version>
<inherited>true</inherited>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${version.install.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${version.jar.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${version.source.plugin}</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>internal</id>
<url>http://xxx.xxx.xxx.com:8098/archiva/repository/internal/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Archiva Managed Snapshot Repository</name>
<url>http://xxx.xxx.xxx.com:8098/archiva/repository/snapshots/</url>
</snapshotRepository>
</distributionManagement>

<repositories>
<repository>
<id>internal</id>
<name>Archiva Managed Internal Repository</name>
<url>http://xxx.xxx.xxx.com:8098/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<name>Archiva Managed Snapshot Repository</name>
<url>http://xxx.xxx.xxx.com:8098/archiva/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>