Eclipse打包jar到maven私服上

时间:2024-04-10 18:57:04

1.pom.xml文件需要 配入Nexus仓库地址

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  
  <groupId>com.crt.member.signin</groupId>
  <artifactId>signin-service-api</artifactId>
  <version>1.0.1-SNAPSHOT</version>
  
   <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.crt.member.signin</groupId>
                <artifactId>signin-service-parent</artifactId>
                <version>1.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <!-- Compiler插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.2</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>UTF-8</encoding>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!--发布 Nexus仓库地址 -->
    <distributionManagement>
        <repository>
            <id>releases</id>
            <name>releases</name>
            <url>http://10.0.79.27:8084/nexus/content/repositories/releases/</url>
        </repository>

        <snapshotRepository>
            <id>snapshots</id>
            <name>snapshots</name>
            <url>http://10.0.79.27:8084/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
</project>

2.点击需要打包的项目右键选择run as ——》Maven build..出现如图所示填写,点击run,控制台打印出BUILD SUCCESS表示打包成功,可以去私服地址搜索对应jar包

Eclipse打包jar到maven私服上


--------------------- 
原文:https://blog.csdn.net/luoxiang183/article/details/81303719