• maven打包到本地仓库


    在项目pom文件目录打开命令,输入以下命令,替换各个属性名,这些属性值如果不清楚可以在jar包解压后的pom.properties内可查看

    mvn install:install-file -Dfile=xxx.jar -DgroupId=com.microsoft.sqlserver -DartifactId=xxxId -Dversion=x.x -Dpackaging=jar

    一般这样就成功了,但是如果出现以下问题:

     

    就需要修改命令为

    mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=xxx.jar

    提示成功

    另:maven打jar包依赖

        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <encoding>UTF-8</encoding>
                        <optimize>true</optimize>
                        <showDeprecation>true</showDeprecation>
                        <showWarnings>true</showWarnings>
                        <compilerArgument>-Xlint:all,-serial,-path,-rawtypes,-unchecked</compilerArgument>
                        <skip>true</skip>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.0.0</version>
                    <configuration>
                        <!--如果想在没有web.xml文件的情况下构建WAR,请设置为false。-->
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
            </plugins>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <includes>
                        <!-- 此处设置打成jar包后保留的静态资源文件 .txt .xml等-->
                        <include>**/*.md</include>
                    </includes>
                </resource>
            </resources>
        </build>

    idea在右边maven工具栏中使用package即可

    如需上传至私服,需要配置仓库地址:

        <distributionManagement>
            <snapshotRepository>
                <id>maven-001</id>
                <!-- name和url需要到私服配置中查看 -->
                <name>xxx</name>
                <url>http://xxx</url>
            </snapshotRepository>
        </distributionManagement>

    然后在本地maven的settings.xml中加入配置:

            <server>
            <!-- id需与pom文件中的id对应 -->
               <id>maven-001</id>
               <username>xxx</username>
               <password>xxx</password>
            </server>

    idea的maven配置内的settings需指向此文件,如果使用的是默认的配置,也就是.m2 epository,需要在m2文件夹新建settings.xml文件,然后将配置项填入

    配置好后,点击idea的meven工具栏内的deploy即可上传

  • 相关阅读:
    Python3 之 列表推导式
    python3 之 趣味数学题(爱因斯坦)
    python3 之 判断闰年小实例
    python3 之 判断字符串是否只为数字(isdigit()方法、isnumeric()方法)
    116.Populating Next Right Pointers in Each Node
    115.Distinct Subsequences
    114.Flatten Binary Tree to Linked List
    113.Path Sum II
    112.Path Sum
    111.Minimum Depth of Binary Tree
  • 原文地址:https://www.cnblogs.com/nvsky/p/11157485.html
Copyright © 2020-2023  润新知