精华内容
下载资源
问答
  • maven打包

    万次阅读 2018-04-24 15:17:57
    maven打包时控制台输出的日志乱码 [WARNING] F:\oxygenworkspace\myproject\src\main\java\com\demo\constants\SqlIdConstants.java:643: ���� - ���@see: "[�����/����]����ѡ��"...

     maven打包时控制台输出的日志乱码
        
        [WARNING] F:\oxygenworkspace\myproject\src\main\java\com\demo\constants\SqlIdConstants.java:643: ���� - ���@see: "[�����/����]����ѡ��" �е� "47" Ϊ�Ƿ��ַ�
    maven默认的字符集是GBK,按照网上大多数的做法在pom.xml的properties中添加属性
        
        <argLine>-Dfile.encoding=UTF-8</argLine>
    如果还是乱码,则通过配置 Run Configerations->maven build->Common->Encoding 设置字符集为GBK来打包,这个与本地Editor的字符集无关
    ##
    另外jdk1.8的doc生成机制比之前更加严谨,如果出现这种错误
        
         ...警告: @param 没有说明
        [ERROR] * @param value
        
         ...错误: @return 的用法无效
        [ERROR] * @return

        ...错误: 意外的文本
        [ERROR] * @throws 重试3次依然异常,抛出异常到业务调用处
        
    说明对doc注解的使用不符合官方的规范,可以在properties中设置属性
        
        <additionalparam>-Xdoclint:none</additionalparam>
    来屏蔽这些检查

    展开全文
  • 文章目录跳过Maven 打包时的测试,跳过Maven 打包测试1、使用Maven 插件2、使用打包参数【推荐】 跳过Maven 打包时的测试,跳过Maven 打包测试 1、使用Maven 插件 修改POM文件 <project> [...] <build...

    跳过Maven 打包时的测试,跳过Maven 打包测试


    1、使用Maven 插件

    修改POM文件

    <project>  
      [...]  
      <build>  
        <plugins>  
          <plugin>  
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-surefire-plugin</artifactId>  
            <version>2.18.1</version>  
            <configuration>  
              <skipTests>true</skipTests>  
            </configuration>  
          </plugin>  
        </plugins>  
      </build>  
      [...]  
    </project> 
    

    2、使用打包参数【推荐】

    1、方式一

    mvn install -DskipTests
    

    或者

    mvn package -DskipTests
    

    2、方式二

    mvn install -Dmaven.test.skip=true
    

    或者

    mvn package -Dmaven.test.skip=true
    
    展开全文
  • 1.maven打包java、scala混合项目 在使用 maven-shade-plugin 插件打包java、scala混合项目的过程中,发现执行mvn package命令打包的jar包中没有scala类, 经发现maven的默认compile不会编译scala类。 1.1 经搜索...

    1.maven打包java、scala混合项目

    在使用 maven-shade-plugin 插件打包java、scala混合项目的过程中,发现执行mvn package命令打包的jar包中没有scala类,

    经发现maven的默认compile不会编译scala类。

    1.1

    经搜索可以添加下面两个插件:

    <plugin>
    	<!-- 这是个编译java代码的 -->
    	<groupId>org.apache.maven.plugins</groupId>
    	<artifactId>maven-compiler-plugin</artifactId>
    	<version>3.2</version>
    	<configuration>
    		<source>1.8</source>
    		<target>1.8</target>
    		<encoding>UTF-8</encoding>
    	</configuration>
    	<executions>
    		<execution>
    			<phase>compile</phase>
    			<goals>
    				<goal>compile</goal>
    			</goals>
    		</execution>
    	</executions>
    </plugin>
    <plugin>
    	<!-- 这是个编译scala代码的 -->
    	<groupId>net.alchim31.maven</groupId>
    	<artifactId>scala-maven-plugin</artifactId>
    	<version>3.2.1</version>
    	<executions>
    		<execution>
    			<id>scala-compile-first</id>
    			<phase>process-resources</phase>
    			<goals>
    				<goal>add-source</goal>
    				<goal>compile</goal>
    			</goals>
    		</execution>
    	</executions>
    </plugin>

    1.2

    还可以使用idea的手动编译项目:

    Build => Build Project,然后执行maven package命令。

     

    2.maven打包指定主类

    <plugin>
    	<groupId>org.apache.maven.plugins</groupId>
    	<artifactId>maven-shade-plugin</artifactId>
    	<version>2.4.3</version>
    	<executions>
    		<execution>
    			<phase>package</phase>
    			<goals>
    				<goal>shade</goal>
    			</goals>
    			<configuration>
    				<filters>
    					<filter>
    						<artifact>*:*</artifact>
    						<excludes>
    							<exclude>META-INF/*.SF</exclude>
    							<exclude>META-INF/*.DSA</exclude>
    							<exclude>META-INF/*.RSA</exclude>
    						</excludes>
    					</filter>
    				</filters>
    				<!-- 指定主类 -->
    				<transformers>
    					<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
    						<mainClass>test.Test</mainClass>
    					</transformer>
    				</transformers>
    			</configuration>
    		</execution>
    	</executions>
    </plugin>

    transformers配置中指定主类。

    之后执行mvn package命令可以生成两个jar包:

    包含依赖的jar包类主类已指定,使用压缩软件打开jar包查看META-INF/MANIFEST.MF文件

     

     

    展开全文
  • Maven 打包问题

    万次阅读 2020-05-06 13:09:32
    Maven 打包问题1、问题描述2、问题分析3、问题解决4、总结 1、问题描述 今天给聚合工程统一打包时出现这样一个异常packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ ...

    1、问题描述

    今天给聚合工程统一打包时出现这样一个异常packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 4, column 109。完整异常如下:

    [INFO] Scanning for projects...
    [ERROR] [ERROR] Some problems were encountered while processing the POMs:
    [ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 4, column 109
     @ 
    [ERROR] The build could not read 1 project -> [Help 1]
    [ERROR]   
    [ERROR]   The project cn.edu.njust:mango_pom:1.0-SNAPSHOT (D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango_pom\pom.xml) has 1 error
    [ERROR]     'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 4, column 109
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
    
    Process finished with exit code 1
    
    

    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">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>cn.edu.njust</groupId>
        <artifactId>mango_pom</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <modules>
            <module>../mango_common</module>
            <module>../mango_core</module>
            <module>../mango</module>
        </modules>
    
    </project>
    

      这是由于统一打包的工程不生成jar包文件,所以需要使用pom格式打包,即<packaging>pom</packaging>。完整正确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">
        <modelVersion>4.0.0</modelVersion>
        <packaging>pom</packaging>
    
        <groupId>cn.edu.njust</groupId>
        <artifactId>mango_pom</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <modules>
            <module>../mango_common</module>
            <module>../mango_core</module>
            <module>../mango</module>
        </modules>
    
    </project>
    

    3、问题解决

    运行程序,结果输出如下:

    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Build Order:
    [INFO] 
    [INFO] mango-common                                                       [jar]
    [INFO] mango_core                                                         [jar]
    [INFO] mango                                                              [jar]
    [INFO] mango_pom                                                          [pom]
    [INFO] 
    [INFO] ---------------------< cn.edu.njust:mango-common >----------------------
    [INFO] Building mango-common 1.0-SNAPSHOT                                 [1/4]
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mango-common ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mango-common ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mango-common ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango_common\src\test\resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ mango-common ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mango-common ---
    [INFO] Tests are skipped.
    [INFO] 
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ mango-common ---
    [INFO] 
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ mango-common ---
    [INFO] Installing D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango_common\target\mango-common-1.0-SNAPSHOT.jar to D:\nanligong\program\java\maven\repos\cn\edu\njust\mango-common\1.0-SNAPSHOT\mango-common-1.0-SNAPSHOT.jar
    [INFO] Installing D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango_common\pom.xml to D:\nanligong\program\java\maven\repos\cn\edu\njust\mango-common\1.0-SNAPSHOT\mango-common-1.0-SNAPSHOT.pom
    [INFO] 
    [INFO] ----------------------< cn.edu.njust:mango_core >-----------------------
    [INFO] Building mango_core 1.0-SNAPSHOT                                   [2/4]
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mango_core ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mango_core ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mango_core ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango_core\src\test\resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ mango_core ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mango_core ---
    [INFO] Tests are skipped.
    [INFO] 
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ mango_core ---
    [INFO] 
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ mango_core ---
    [INFO] Installing D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango_core\target\mango_core-1.0-SNAPSHOT.jar to D:\nanligong\program\java\maven\repos\cn\edu\njust\mango_core\1.0-SNAPSHOT\mango_core-1.0-SNAPSHOT.jar
    [INFO] Installing D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango_core\pom.xml to D:\nanligong\program\java\maven\repos\cn\edu\njust\mango_core\1.0-SNAPSHOT\mango_core-1.0-SNAPSHOT.pom
    [INFO] 
    [INFO] -------------------------< cn.edu.njust:mango >-------------------------
    [INFO] Building mango 0.0.1-SNAPSHOT                                      [3/4]
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ mango ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 1 resource
    [INFO] Copying 12 resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ mango ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ mango ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango\src\test\resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ mango ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ mango ---
    [INFO] Tests are skipped.
    [INFO] 
    [INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ mango ---
    [INFO] Building jar: D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango\target\mango-0.0.1-SNAPSHOT.jar
    [INFO] 
    [INFO] --- spring-boot-maven-plugin:2.2.6.RELEASE:repackage (repackage) @ mango ---
    [INFO] Replacing main artifact with repackaged archive
    [INFO] 
    [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ mango ---
    [INFO] Installing D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango\target\mango-0.0.1-SNAPSHOT.jar to D:\nanligong\program\java\maven\repos\cn\edu\njust\mango\0.0.1-SNAPSHOT\mango-0.0.1-SNAPSHOT.jar
    [INFO] Installing D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango\pom.xml to D:\nanligong\program\java\maven\repos\cn\edu\njust\mango\0.0.1-SNAPSHOT\mango-0.0.1-SNAPSHOT.pom
    [INFO] 
    [INFO] -----------------------< cn.edu.njust:mango_pom >-----------------------
    [INFO] Building mango_pom 1.0-SNAPSHOT                                    [4/4]
    [INFO] --------------------------------[ pom ]---------------------------------
    [INFO] 
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ mango_pom ---
    [INFO] Installing D:\nanligong\mianshi\project\20200505\fuxi\springcloudproject\mongo_back02\mango_pom\pom.xml to D:\nanligong\program\java\maven\repos\cn\edu\njust\mango_pom\1.0-SNAPSHOT\mango_pom-1.0-SNAPSHOT.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] mango-common ....................................... SUCCESS [  1.477 s]
    [INFO] mango_core ......................................... SUCCESS [  0.045 s]
    [INFO] mango 0.0.1-SNAPSHOT ............................... SUCCESS [  3.562 s]
    [INFO] mango_pom 1.0-SNAPSHOT ............................. SUCCESS [  0.009 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 6.091 s
    [INFO] Finished at: 2020-05-06T13:06:40+08:00
    [INFO] ------------------------------------------------------------------------
    [WARNING] The requested profile "nexus" could not be activated because it does not exist.
    
    Process finished with exit code 0
    

    打包成功!

    4、总结

      书上的代码直接运行绝大部分是对的,但是总有一些软件的更新使得作者无能为力。之前的API是对的,但是之后就废弃了或修改了是常有的事。所以我们需要跟踪源代码。这只是一个小小的问题,如果没有前辈的无私奉献,很难想象我们自己一天能学到多少内容。感谢各位前辈的辛勤付出,让我们少走了很多的弯路!

    点个赞再走呗!欢迎留言哦!

    展开全文
  • maven打包失败

    千次阅读 2017-01-12 17:08:20
    maven打包失败
  • idea maven打包 install 报错,信息如下: 这是说找不到插件的包,其实不是找不到这个打包插件,而是自己的项目没有从maven仓库里加载这个包到项目里, idea中打包maven项目,有两个install;一直就用Plugins下...
  • springboot+maven maven打包配置

    千次阅读 2018-09-07 11:18:17
    下面是整理的springboot通用maven打包配置 &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;...
  • maven 打包Could not resolve dependencies for project 1.maven 打包Could not resolve dependencies for project 项目上使用的是idea ide的多模块话,也就是父子工程,需要模块之间的依赖,比如说服务模块依赖协议...
  • 在使用maven打包时,出现以下错误 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project flow-traffic-statistics: Unable to generate classpath: org....
  • 具体表现在maven打包时报错: 使用的命令是mvn clean package -Dmaven.test.skip 解决方法 指定要执行的settings.xml配置文件,原因可能是命令行执行的settings.xml文件和实际的不符,使用如下命令 mvn clean ...
  • maven打包依赖jar的方式

    千次阅读 2017-03-01 19:42:12
    maven打包
  • maven打包时跳过测试

    万次阅读 多人点赞 2018-04-18 11:45:17
    准备打包maven package),没想到在执行到TEST阶段报错。百思不得其解,决定跳过测试去打包,然后部署。 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test 在运行mvn ...
  • Maven 打包 package install deploy-

    万次阅读 2015-08-12 16:59:25
    Maven 打包 package install deploy
  • IDEA maven打包错误

    千次阅读 2018-09-30 13:46:06
    1.出现maven打包错误: 2.
  • maven打包 jar中没有主清单属性

    万次阅读 2019-07-31 10:31:50
    问题: ...springboot项目通过maven打包程序后,直接执行jar包时,控制台显示“没有主清单属性”。 解决: 在maven的pom文件中,编写maven-jar-plugin 的插件,具体如下 <plugin> &...
  • Maven打包设置主类

    2020-01-12 17:45:47
    Maven 打包设置主类 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2...
  • STS maven打包springboot

    千次阅读 2019-07-15 00:00:24
    用sts通过maven打包springboot项目 默认JRE改为JDK 1.点击windows——>preference——>java——>INSTALLED JREs,查看右边的内容,如果是jre,就将其改为jdk。否则打包编译时会报No com...
  • maven 打包内存溢出

    千次阅读 2019-07-11 15:24:24
    idea中 Maven打包报错 [ERROR] PermGen space -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable...
  • maven打包插件配置

    2019-09-06 11:16:57
    一、maven打包可执行jar文件,需要引入插件 <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <appendAssemblyId>false</appendAssemblyId> ...
  • Spring Boot Maven打包去掉不需要的文件

    万次阅读 多人点赞 2016-03-03 10:27:51
    Spring Boot Maven打包去掉不需要的资源文件。 如果使用Spring Boot去掉不需要的文件,使用这个配置好像没有作用 src/main/resources resouces templates 换一种方式:
  • Maven打包太慢??

    千次阅读 2020-07-22 16:13:34
    Maven打包太慢??构建项目太慢
  • maven打包常用命令总结

    万次阅读 2019-10-24 23:15:38
    maven打包常用命令总结基本命令介绍1、mvn clean2、mvn compile3、mvn package4、mvn install5、mvn deploy生产环境打包举例1、生产环境根据源码构建项目:2、可用用到的其他mvn参数介绍: 开发过程中常见以下几个...
  • maven 打包上传到私服

    万次阅读 2017-02-28 20:44:04
    maven打包上传到私服
  • 记一次maven打包失败:Compilation failure

    千次阅读 2019-10-08 16:03:12
    记一次maven打包失败:Compilation failure 本篇文章要点如下: 一.maven打包报错详情 二.将本地jar包上传到nexus 上传普通的第三方jar包 上传snapshots jar包 三.打包方式 使用springboot方式打包 使用maven方式...
  • Eclipse的插件Maven打包

    万次阅读 2016-04-21 10:57:12
    Eclipse插件Maven打包
  • maven 打包 protobuf

    千次阅读 2014-08-12 23:22:14
    maven 打包 protobuf[转]  windows环境下载maven ,把maven 的bin目录加入到环境变量. cmd 面板 mvn -versions 查看是否配置成功 1. 下载 protobuf最新版本:...
  • SpringBoot-Maven打包压缩瘦身

    千次阅读 2020-02-24 21:40:12
    SpringBoot-Maven打包压缩瘦身一、Spring Boot 可执行 jar 分析1.1 打包1.2 两种 jar 的比较1.3 一次打包两个 jar二、SpringBoot迭代发布JAR瘦身配置三、引入内部编译的依赖四、Spring Boot Thin Launcher五、 maven...
  • 三、将项目通过maven打包到本地 四、打包成功后查看maven编译文件(通过打包路径可查看打包信息) 五、其他项目引用本地Maven依赖(这里的groupId、ArtifactId、version与第三步中保持一致即可) ...
  • mvn clean kotlin:compile package

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 31,652
精华内容 12,660
关键字:

maven打包