精华内容
下载资源
问答
  • maven 指定jdk版本打包

    千次阅读 2018-06-04 10:57:00
    在中指定jdk1.7 <id>jdk-1.7 <activeByDefault>true <jdk>1.7</jdk> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <maven.compiler....

    修改setting.xml

    在<profiles>中指定jdk1.7

    <profile>
        <id>jdk-1.7</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.7</jdk>
        </activation>
        <properties>
            <maven.compiler.source>1.7</maven.compiler.source>
            <maven.compiler.target>1.7</maven.compiler.target>
            <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
        </properties>
    </profile>    
    

    在pom.xml配置

    <plugins>
        <!-- 编译插件 -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
    </plugins>
    

    转载于:https://my.oschina.net/yan5845hao/blog/1823686

    展开全文
  • maven打包指定jdk版本

    2019-09-30 12:05:25
    <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> ...
    <plugin>  
        <groupId>org.apache.maven.plugins</groupId>  
        <artifactId>maven-compiler-plugin</artifactId>  
        <version>3.1</version>  
        <configuration>  
            <verbose>true</verbose>  
            <fork>true</fork>  
            <executable>${JAVA8_HOME}/bin/javac</executable>  
        </configuration>  
    </plugin>  

     

    转载于:https://www.cnblogs.com/yangxianyu/p/8145249.html

    展开全文
  • eclipse和idea设置maven项目编译打包jdk版本 1.背景 对于MAVEN项目,打包成不同jdk版本,针对性比较强 打包插件:maven-shade-plugin 打包jdk版本 1.8打成1.6 maven发布历史及对应jdk版本要求 ...

    eclipse和idea设置maven项目指定jdk版本打包编译

    1.背景

    对于MAVEN项目,打包成不同jdk版本,针对性比较强
    打包插件:maven-shade-plugin
    打包jdk版本 1.8打成1.6

    maven发布历史及对应jdk版本要求

    maven发布历史及对应jdk版本要求
    在这里插入图片描述

    maven历史版本下载网址

    maven历史版本下载
    官网网址 https://archive.apache.org/dist/maven/maven-3/
    1、在项目的pom文件中加入如下配置
    jdk版本后续在更新

    1、pom文件设置

    	<build>
            <finalName>are_mi_sdk-1.0-SNAPSHOT</finalName>
            <plugins>
                <plugin>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>2.4.3</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <transformers>
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                </transformers>
                                <filters>
                                    <filter>
                                        <artifact>*:*</artifact>
                                        <excludes>
                                            <exclude>META-INF/*.SF</exclude>
                                            <exclude>META-INF/*.DSA</exclude>
                                            <exclude>META-INF/*.RSA</exclude>
                                        </excludes>
                                    </filter>
                                </filters>
    
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    

    注:
    finalName 自定义打包名
    打包后会有两个包,一个带依赖包,一个不带依赖包,根据大小判定。
    注意项目编码

    	<properties>
         <!-- 文件拷贝时的编码 -->
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <!-- 编译时的编码 -->
         <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
     </properties>
    

    2.idea设置

    。jdk1.8设置
    	maven设置
    

    在这里插入图片描述

    在这里插入图片描述

    jdk设置,如果在maven/conf/setting.xml文件配置jdk版本,可省略此步骤
    在这里插入图片描述

    上述地方改成maven3.2.5以下和jdk1.6

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    2.eclipse

    。jdk1.8设置改为jdk1.6
    

    Window > Preferences > maven在这里插入图片描述在这里插入图片描述

    右键项目 > Preferences
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    展开全文
  • maven指定jdk路径

    万次阅读 2018-12-29 15:21:53
    Perhaps you are running on a JRE rather than a JDK? [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] -----------------------------------------------------...

    mvn clean package

     

    Warning: JAVA_HOME environment variable is not set.
    [INFO] Scanning for projects...
    [WARNING] 
    [WARNING] Some problems were encountered while building the effective model for io.nuls.client-module:client:jar:1.1.6
    [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: io.nuls.network-module:network-netty:jar -> duplicate declaration of version 1.1.6 @ line 246, column 21
    [WARNING] 
    [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
    [WARNING] 
    [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
    [WARNING] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Build Order:
    [INFO] 
    [INFO] nuls
    [INFO] tools-module
    [INFO] tools
    [INFO] core-module
    [INFO] kernel
    [INFO] account-module
    [INFO] account
    [INFO] db-module
    [INFO] db
    [INFO] account-storage
    [INFO] cache
    [INFO] network-module
    [INFO] network
    [INFO] db-leveldb
    [INFO] ledger-module
    [INFO] ledger
    [INFO] contract-module
    [INFO] contract
    [INFO] account-ledger-module
    [INFO] account-ledger
    [INFO] protocol-module
    [INFO] protocol
    [INFO] message-bus-module
    [INFO] message-bus
    [INFO] account-base
    [INFO] account-rpc
    [INFO] account-ledger-storage
    [INFO] consensus-module
    [INFO] consensus
    [INFO] account-ledger-base
    [INFO] account-ledger-rpc
    [INFO] kernel-rpc
    [INFO] consensus-poc-storage
    [INFO] consensus-poc-protocol
    [INFO] protocol-storage
    [INFO] ledger-utxo-storage
    [INFO] ledger-utxo-base
    [INFO] network-storage
    [INFO] network-protocol
    [INFO] network-netty
    [INFO] protocol-base
    [INFO] consensus-poc-base
    [INFO] protocol-rpc
    [INFO] consensus-poc-rpc
    [INFO] ledger-utxo-rpc
    [INFO] network-rpc
    [INFO] contract-storage
    [INFO] contract-ledger
    [INFO] contract-vm
    [INFO] contract-tx
    [INFO] contract-base
    [INFO] contract-rpc
    [INFO] message-bus-base
    [INFO] utxo-accounts-module
    [INFO] utxo-accounts-storage
    [INFO] utxo-accounts
    [INFO] utxo-accounts-base
    [INFO] utxo-accounts-rpc
    [INFO] client-module
    [INFO] client
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building nuls 1.1.6
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ nuls ---
    [INFO] 
    [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ nuls ---
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building tools-module 1.1.6
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tools-module ---
    [INFO] 
    [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ tools-module ---
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building tools 1.1.6
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tools ---
    [INFO] Deleting /opt/soft/nuls/nuls/tools-module/tools/target
    [INFO] 
    [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ tools ---
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tools ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /opt/soft/nuls/nuls/tools-module/tools/src/main/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ tools ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 51 source files to /opt/soft/nuls/nuls/tools-module/tools/target/classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR : 
    [INFO] -------------------------------------------------------------
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [INFO] 1 error
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] nuls ............................................... SUCCESS [ 0.661 s]
    [INFO] tools-module ....................................... SUCCESS [ 0.015 s]
    [INFO] tools .............................................. FAILURE [ 0.253 s]
    [INFO] core-module ........................................ SKIPPED
    [INFO] kernel ............................................. SKIPPED
    [INFO] account-module ..................................... SKIPPED
    [INFO] account ............................................ SKIPPED
    [INFO] db-module .......................................... SKIPPED
    [INFO] db ................................................. SKIPPED
    [INFO] account-storage .................................... SKIPPED
    [INFO] cache .............................................. SKIPPED
    [INFO] network-module ..................................... SKIPPED
    [INFO] network ............................................ SKIPPED
    [INFO] db-leveldb ......................................... SKIPPED
    [INFO] ledger-module ...................................... SKIPPED
    [INFO] ledger ............................................. SKIPPED
    [INFO] contract-module .................................... SKIPPED
    [INFO] contract ........................................... SKIPPED
    [INFO] account-ledger-module .............................. SKIPPED
    [INFO] account-ledger ..................................... SKIPPED
    [INFO] protocol-module .................................... SKIPPED
    [INFO] protocol ........................................... SKIPPED
    [INFO] message-bus-module ................................. SKIPPED
    [INFO] message-bus ........................................ SKIPPED
    [INFO] account-base ....................................... SKIPPED
    [INFO] account-rpc ........................................ SKIPPED
    [INFO] account-ledger-storage ............................. SKIPPED
    [INFO] consensus-module ................................... SKIPPED
    [INFO] consensus .......................................... SKIPPED
    [INFO] account-ledger-base ................................ SKIPPED
    [INFO] account-ledger-rpc ................................. SKIPPED
    [INFO] kernel-rpc ......................................... SKIPPED
    [INFO] consensus-poc-storage .............................. SKIPPED
    [INFO] consensus-poc-protocol ............................. SKIPPED
    [INFO] protocol-storage ................................... SKIPPED
    [INFO] ledger-utxo-storage ................................ SKIPPED
    [INFO] ledger-utxo-base ................................... SKIPPED
    [INFO] network-storage .................................... SKIPPED
    [INFO] network-protocol ................................... SKIPPED
    [INFO] network-netty ...................................... SKIPPED
    [INFO] protocol-base ...................................... SKIPPED
    [INFO] consensus-poc-base ................................. SKIPPED
    [INFO] protocol-rpc ....................................... SKIPPED
    [INFO] consensus-poc-rpc .................................. SKIPPED
    [INFO] ledger-utxo-rpc .................................... SKIPPED
    [INFO] network-rpc ........................................ SKIPPED
    [INFO] contract-storage ................................... SKIPPED
    [INFO] contract-ledger .................................... SKIPPED
    [INFO] contract-vm ........................................ SKIPPED
    [INFO] contract-tx ........................................ SKIPPED
    [INFO] contract-base ...................................... SKIPPED
    [INFO] contract-rpc ....................................... SKIPPED
    [INFO] message-bus-base ................................... SKIPPED
    [INFO] utxo-accounts-module ............................... SKIPPED
    [INFO] utxo-accounts-storage .............................. SKIPPED
    [INFO] utxo-accounts ...................................... SKIPPED
    [INFO] utxo-accounts-base ................................. SKIPPED
    [INFO] utxo-accounts-rpc .................................. SKIPPED
    [INFO] client-module ...................................... SKIPPED
    [INFO] client ............................................. SKIPPED
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.648 s
    [INFO] Finished at: 2018-12-29T14:30:27+08:00
    [INFO] Final Memory: 16M/217M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project tools: Compilation failure
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [ERROR] -> [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 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/MojoFailureException
    [ERROR] 
    [ERROR] After correcting the problems, you can resume the build with the command
    [ERROR] mvn <goals> -rf :tools

     

     

    配置jdk环境变量

    vim /etc/profile

    JAVA_HOME=/usr/local/jdk1.7.0_79/
    JRE_HOME=$JAVA_HOME/jre #注意 jdk10解压后是没有jre目录的所以这里直接配成$JAVA_HOME/即可 去掉jre
    PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
    CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
    export JAVA_HOME JRE_HOME PATH CLASSPATH


    source /etc/profile
     

    发现了问题 maven从jre路径中读取的 而非jdk

    添加插件 并指定jdk路径

    <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.7.0</version>
    <configuration>
    <fork>true</fork>
    <executable>/opt/soft/java/jdk1.8.0_144/bin/javac</executable>
    </configuration>
    </plugin>

     

     

    推荐 参考资料 https://www.baeldung.com/maven-java-home-jdk-jre

    展开全文
  • <build> <pluginManagement> <plugins> <...org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>.
  • pom.xml-结构 org.example Qsy_OA 1.0.1...\Program Files\Java\jdk1.6.0_45\bin\javac utf8 org.apache.maven.plugins maven-assembly-plugin com.jw.oa.UploadFile config/ jar-with-dependencies false 执行package
  • Maven工程指定JDK版本的两种方式

    千次阅读 2020-04-09 23:37:37
    (1)标准maven方式 所有应用都可以使用这种配置方式 <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> &...
  • Maven指定JDK版本为1.7

    2016-12-01 23:32:00
    建立Maven工程后默认使用的是JDK1.5 在pom.xml文件中添加 <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> 或使用编译插件 <groupId>...
  • <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</ar...
  • jdk+maven配置流程

    2016-12-02 17:32:24
    jdk+maven配置流程,配置手顺,简单快捷。
  • maven设置编译jdk版本,以及maven打包

    千次阅读 2019-06-27 09:27:07
    今天部署项目,我打包的jar包和我对接项目居然不能用,原来是对接项目jdk是1.7,其实问题不大,可以同步maven使用jdk7重新进行打包。 1、设置编译版本为jdk 1.8 1 2 3 4 5 6 7 8 ...
  • maven 使用 mvn 脚本指定JDK环境和路径

    千次阅读 2020-07-01 18:38:59
    maven 在使用的时候,可能需要用到不同的JDK环境,但是系统只能配置一个环境变量,那这个是就需要指定JDK环境来达到目的 mvn 和mvn.bat mvn是linux系统使用的启动文件 mvn.bat是window 使用的启动文件 以下...
  • <properties> <!-- 声明一个 java.version 的变量,后面直接引用就可以,改起来...-- 指定项目编码 --> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </pr.
  • mac配置mavenjdk

    2020-12-16 10:33:40
    vim ~/.bash_profile 查看mac jdk的路径 maven home export MAVEN_HOME=/usr/local/Cellar/maven/3.6.3_1/libexec export PATH=$PATH:$...export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk
  • Maven打包所使用的JDK

    2018-01-16 14:40:00
    Maven打包可以指定JDK,请看如下配置: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=...
  • 在项目中,可能会遇到本地mavenJDK编译版本与生产环境不同的情况。本文对如何修改maven打包JDK版本,以及其中遇到的问题进行了总结。
  • maven切换jdk

    2020-05-28 14:02:58
    在项目中的pom.xml指定jdk版本,如下: <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> &...
  • Maven 指定jdk编译版本

    千次阅读 2019-08-27 16:21:37
    默认情况下, maven 项目默认使用jdk1.5 编译项目, 但是jdk1.5 版本太老了, 因此我们需要配置maven 使用jdk1.8 来编译项目. 我们可以借助maven 插件: maven-compiler-plugin 来实现. 配置maven 编译插件 在maven ...
  • maven使用JDK1.8编译

    千次阅读 2019-07-14 12:47:44
    文章目录让maven使用JDK1.8编译设置参数配置插件参考 让maven使用JDK1.8编译 让maven使用你想要的JDK版本进行编译,有两个方式可以达到效果,这里以目标版本JDK1.8举例。 设置参数 <project> [...] <...
  • &...-- 指定jdk,防止update project --&gt;  &lt;plugin&gt;  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;  &lt;artifactId&gt;maven-co
  • 解决办法一:在项目中的pom.xml指定jdk版本,如下: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <art...
  • 主要介绍了Maven3种打包方式中maven-assembly-plugin的使用,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
  • jenkins配置mavenJDK

    千次阅读 2020-04-19 10:27:04
    在使用jenkins进行持续集成的时候,需要对拉取到本地仓库的代码进行编译和打包,因此离不开JDKmaven的配置,下面简单演示下jenkins上配置mavenJDK 配置MavenJDK jenkins所在服务器安装maven 1、下载maven的...
  • Jenkins之配置MavenJDK-yellowcong

    千次阅读 2017-10-19 15:15:32
    >系统管理->Global Tool Configuration1、配置jdk#获取到服务器上JAVA_HOME配置的地址 echo $JAVA_HOME设置到Jenkins上2、配置Mavenecho $M2_HOME #一般都放到usr/local目录下 #/usr/local/maven/apache-maven-3.5.0...
  • maven打包不同jdk版本的包

    千次阅读 2019-06-20 09:51:14
    对于MAVEN项目,我们存在将一个工程同样的代码部署到不同的环境上去的场景,且这些环境的jdk版本可能会不同,那么如何一份代码打不同的jdk版本的包呢? 基于maven我们就可以很方便的做到这点。 1、在项目的pom文件...
  • 在idea,新建建立或者导入的MAVEN项目,编译时不指定编译版本,会自动编程成jdk1.5版本的,不利于项目的开发,百度一番,未能完美解决问题,有两个可借鉴的方式,比较粗暴。
  • maven打包控制JDK版本

    2019-09-20 00:33:26
    本地默认jdk 1.8打的包, sdk发布后, 有小伙伴说必须要用1.7的. 解决办法: 在pom配置中添加: <build> <plugin> <groupId>org.apache.maven.plugins</groupId> <...
  • 首先描述经过,我是开始安装了JDK7,但是项目需要,必须是升级到8,因为项目用到8的新特性,所以项目在maven编译都不会通过,我开始想肯定要换版本,于是就安装了8,重新更新了环境变量,java -version一切正常。...
  • jenkins mavenjdk配置

    2020-04-15 18:24:46
    同jenkins服务器mavenjdk环境变量配置类似 JAVA_HOME/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64 M2_HOME/usr/local/apache-maven-3.6.3 PATH+EXTRA$M2_HOME/bin ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 23,328
精华内容 9,331
关键字:

maven指定jdk打包