zoukankan      html  css  js  c++  java
  • maven打包jar源码至私服

    1. setting文件 配置私服中设置的用户和密码

     <servers>
            <server>
                <id>releases</id>  
                <username>admin</username>  
                <password>xxxxxxxxxxx</password>  
            </server>
            <server>
                <id>snapshots</id>  
                <username>admin</username>  
                <password>xxxxxxxxx</password>  
           </server>  
           <server>
                <id>Nexus</id>  
                <username>admin</username>  
                <password>xxxxxxx</password>  
           </server>  
           <server>
                <id>Nexus2</id>  
                <username>admin</username>  
                <password>xxxxxxx</password>  
           </server>

    2.需要打包的项目的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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <version>1.1.0</version>
        <modelVersion>4.0.0</modelVersion>
        <packaging>jar</packaging>
        <artifactId>msg-service</artifactId>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <maven.compiler.plugin.version>3.2</maven.compiler.plugin.version>
            <maven_jar_plugin_version>2.4</maven_jar_plugin_version>
        </properties>
    
        <dependencies>
           
            <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-dependency-plugin -->
            <dependency>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.0.1</version>
            </dependency>
    
        </dependencies>
    
        <distributionManagement>
            <repository>
                <id>releases</id>
                <name>Maven Snapshots</name>
                <url>http://192.168.79.16:9081/nexus/content/repositories/releases</url>
            </repository>
            <snapshotRepository>
                <id>snapshots</id>
                <name>Maven Snapshots</name>
                <url>http://192.168.79.16:9081/nexus/content/repositories/snapshots</url>
            </snapshotRepository>
        </distributionManagement>
    
        <build>
            <finalName>msg-service</finalName>
            <sourceDirectory>src/main/java/com/fqgj/jkzj/msg/service</sourceDirectory>
            <!--<resources>-->
            <!--&lt;!&ndash; 控制资源文件的拷贝 &ndash;&gt;-->
            <!--<resource>-->
            <!--<directory>...</directory>-->
            <!--</resource>-->
            <!--</resources>-->
    
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.plugin.version}</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <inherited>true</inherited>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.19.1</version>
                    <configuration>
                        <skip>true</skip><!-- 跳过测试 -->
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven_jar_plugin_version}</version>
                    <configuration>
                        <archive>
                            <addMavenDescriptor>true</addMavenDescriptor>
                            <index>true</index>
                            <manifest>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.1</version>
                    <configuration>
                        <attach>true</attach>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>compile</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
  • 相关阅读:
    搭建SpringCloud之注册中心Eureka
    学习角色管理模块错误总结---基于SpringMVC框架
    【转】Eclipse 单步调试
    [转]MyBatis的foreach语句详解
    解决pom.xml文件 ---- web.xml is missing and <failOnMissingWebXml> is set to true
    解决Dynamic Web Module 3.0 Requires Java 1.6 or newer
    用maven在eclipse用spring建javaweb工程(一)
    【转载】Eclipse 断点调试
    学习大神笔记之“MyBatis学习总结(三)”
    学习大神笔记之“MyBatis学习总结(二)”
  • 原文地址:https://www.cnblogs.com/likun10579/p/7221263.html
Copyright © 2011-2022 走看看