zoukankan      html  css  js  c++  java
  • maven 上传 java工程源码到私服

    默认 mvn deploy 会上传 jar, 但是如何 maven  java工程上传源码到私服?

        <build>
            <resources>
                <!--mvn打包时,加入mvn外的jar包-->
                <resource>
                    <directory>lib</directory>
                    <targetPath>BOOT-INF/lib</targetPath>
                    <includes>
                        <include>**/*.jar</include>
                    </includes>
                </resource>
                <resource>
                    <directory>src/main/java</directory>
                    <!--java文件中的xml文件允许打进包中,这部分是mybatis文件-->
                    <includes>
                        <include>**/*.xml</include>
                    </includes>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <!--这里打包的时候不打配置文件,因为这里的jar包仅供其他项目集成,应该在使用此jar的最外层加配置-->
                    <excludes>
                        <exclude>*.properties</exclude>
                        <exclude>*.xml</exclude>
                    </excludes>
                </resource>
            </resources>
    
            <pluginManagement>
                <!--加入打包插件,这个插件与Nexus配合把包上传到私服仓库中-->
                <plugins>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                        <configuration>
                            <attach>true</attach>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
    
                            <execution>
                                <id>attach-sources</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
    
                        </executions>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>

    上面的两个 execution 其实没必要的, 一个即可, 就是:

    <execution>
      <phase>compile</phase>
      <goals>
        <goal>jar</goal>
      </goals>
    </execution>

    就可以了! 否则就会 进行两次的  创建 -sources.jar  的操作, (日志出现两行 -sources.jar日志)

    设置 

    <configuration>
      <attach>true</attach>
    </configuration>

    也是没必要的, 好像默认就是。

    貌似 plugin 并不能 继承, pom 的子 module  还是得加下面的才行:

        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                </plugin>
            </plugins>
        </build>

    这样之后, maven install日志就会出现:

    [INFO] Installing D:codegitmwumc-protocol-smsprotocol-sms-std argetprotcol-sms-std-1.0.0.1-sources.jar to C:Userslk.m2 epositorycomfffumcprotcol-sms-std1.0.0.1protcol-sms-std-1.0.0.1-sources.jar

    这样就表示 本地仓库安装成功! 生效了 !

    然后deploy 一下, 就到了私服。


    版权声明
    本文原创发表于 博客园,作者为 阿K .     本文欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则视为侵权。
    欢迎关注本人微信公众号:觉醒的码农,或者扫码进群:

  • 相关阅读:
    css3 object-fit详解
    Timing path
    IUS
    FIFO深度
    UVM中的class--2
    UVM中的class
    Binding
    Concurrent Assertion
    Immediate assertion
    sdf
  • 原文地址:https://www.cnblogs.com/FlyAway2013/p/15213256.html
Copyright © 2011-2022 走看看