SpringBoot maven打包源码发布到仓库配置

 一、项目pom.xml配置

添加发布仓库

配置上传源码

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.9.RELEASE</version>
        <relativePath/>
    </parent>
    <groupId>com.mk</groupId>
    <artifactId>test-maven</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <name>test-maven</name>
    <description>test maven</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <distributionManagement>
        <repository>
            <id>releases-deploy</id>
            <name>release Repository</name>
            <url>http://maven.mk.com/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots-deploy</id>
            <name>snapshots Repository</name>
            <url>http://maven.mk.com/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>


    <build>
        <plugins>
            <!-- 上传源码插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>install</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

 

二、maven setting.xml配置

配置仓库密码

也可以把仓库配置在setting文件里面mirror里面

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <servers>
    <server>
      <id>releases-deploy</id>
      <username>test-releases</username>
      <password>R12345</password>
    </server>
    <server>
      <id>snapshots-deploy</id>
      <username>test-snapshots</username>
      <password>S12345</password>
    </server>
  </servers>
 
</settings>

 

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读