zoukankan      html  css  js  c++  java
  • maven使用

    导入maven项目,不自动下载依赖

    使用IDEA import maven项目不有的时候不自动下载依赖,这时候,右键pom文件, 选择maven,reimport即可

    下载maven依赖报错,在远程仓库找不到

      <build>
        <sourceDirectory>src/main/scala</sourceDirectory>
        <plugins>
          <plugin>
            <groupId>org.scala-tools</groupId>
            <artifactId>maven-scala-plugin</artifactId>
            <version>2.15.2</version>   -- 新添加
            <executions>
              <execution>
                <goals>
                  <goal>compile</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <scalaVersion>${scala.version}</scalaVersion>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <configuration>
              <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
              </descriptorRefs>
            </configuration>
            <executions>
              <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    

    在下载maven-scala-plugin的时候,报错,找不到远程依赖,这时候,到远程仓库看到,只有2.15.2版本,在原始pom文件中添加2.15.2就可以了

    maven打包把源码打进去方法:

    在maven项目里如果引用了第三方jar包,在idea中按Crul+当前方法弹不出源码的话,需要下载maven的源码
    做到能看源码的条件:

    • 在本地仓库里必须要含有${filename}-sources.jar
      完整的应该有如下文件:
    <plugin>
    	<groupId>org.apache.maven.plugins</groupId>
    	<artifactId>maven-source-plugin</artifactId>
    	<version>3.0.0</version>
    	<!-- 绑定source插件到Maven的生命周期,并在生命周期后执行绑定的source的goal -->
    	<executions>
    		<execution>
    			<!-- 绑定source插件到Maven的生命周期 -->
    			<phase>compile</phase>
    			<!--在生命周期后执行绑定的source插件的goals -->
    			<goals>
    				<goal>jar-no-fork</goal>
    			</goals>
    		</execution>
    	</executions>
    </plugin>
    
    

    maven-source-plugin提供项目自动将源码打包并发布的功能,在需要发布源码项目的pom.xml文件中添加如下代码即可
    执行 mvn install,maven会自动将source install到repository 。
    执行 mvn deploy,maven会自动将source deploy到remote-repository 。
    执行 mvn source:jar,单独打包源码。

    spring整合docker

    在我们持续集成过程中,项目工程一般使用 Maven 编译打包,然后生成镜像,通过镜像上线,能够大大提供上线效率,同时能够快速动态扩容,快速回滚,着实很方便。docker-maven-plugin 插件就是为了帮助我们在Maven工程中,通过简单的配置,自动生成镜像并推送到仓库中。
    参考:https://blog.csdn.net/aixiaoyang168/article/details/77453974

    报Plugin 'com.spotify:docker-maven-plugin:1.0.0' not found


    解决办法:
    有解决办法后再补充

  • 相关阅读:
    Candy leetcode java
    Trapping Rain Water leetcode java
    Best Time to Buy and Sell Stock III leetcode java
    Best Time to Buy and Sell Stock II leetcode java
    Best Time to Buy and Sell Stock leetcode java
    Maximum Subarray leetcode java
    Word Break II leetcode java
    Word Break leetcode java
    Anagrams leetcode java
    Clone Graph leetcode java(DFS and BFS 基础)
  • 原文地址:https://www.cnblogs.com/goldenSky/p/12978391.html
Copyright © 2011-2022 走看看