• 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>
  • 相关阅读:
    老齐所谓“你们强大的数学知识”
    Party解题报告
    maven配置mybatis忽略文件问题
    Log4J使用
    Mybatis的工具类
    MyBatis的BUG总结
    Mybatis核心配置文件
    JavaWebServletBUG总结
    浏览器同源策略问题解决方式
    Erlang语言之简述及安装
  • 原文地址:https://www.cnblogs.com/likun10579/p/7221263.html
Copyright © 2020-2023  润新知