maven打包jar上传远程仓库

maven打包jar上传远程仓库

创建角色、用户


查看远程仓库地址


setting.xml文件设置

这里的id要和远程地址仓库中的ID一致

<server>
  <id>releasesid>
  <username>devusername>
  <password>密码password>
server>
<server>
  <id>snapshotsid>
  <username>devusername>
  <password>密码password>
server>

pom.xml文件设置

可以分别上传releases版本和snapshots版本,两种版本区分点在于releases不覆盖,snapshots覆盖本地版本

    <groupId>com.km.coregroupId>
    <artifactId>km-coreartifactId>
    <version>2.0.8-SNAPSHOTversion>

远程地址和图片上一致

<distributionManagement>
    <repository>
        <id>releasesid>
        <url>http://192.168.96.23:8081/nexus/content/repositories/releasesurl>
    repository>
    <snapshotRepository>
        <id>snapshotsid>
        <url>http://192.168.96.23:8081/nexus/content/repositories/snapshotsurl>
    snapshotRepository>
distributionManagement>

编译上传远程仓库带源码

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.pluginsgroupId>
            <artifactId>maven-compiler-pluginartifactId>
            <version>3.5.1version>
            <configuration>
                <source>1.7source>
                <target>1.7target>
            configuration>
        plugin>
        <plugin>
            <groupId>org.apache.maven.pluginsgroupId>
            <artifactId>maven-source-pluginartifactId>
            <version>3.0.1version>
            <executions>
                <execution>
                    <id>attach-sourcesid>
                    <goals>
                        <goal>jar-no-forkgoal>
                    goals>
                execution>
            executions>
        plugin>
    plugins>
build>

版权声明

作者:苏陌年
出处:http://www.zhengzy.top/
版权所有,欢迎保留原文链接进行转载:)

你可能感兴趣的:(Maven)