maven mvn 命令行 编译打包

maven mvn 命令行 编译打包*一行命令#切换到项目根目录mvnclean&&mvncompile&&mvnpackage&&starttarget*配置好jdkmaven教程*下载安装mavenhttp://maven.apache.org/download.cgiapache-maven-3.3.3-bin….

大家好,又见面了,我是你们的朋友全栈君。

* 一行命令

# 切换到项目根目录
mvn clean && mvn compile && mvn package && start target

 

* 配置好jdk

JAVA_HOME=Java安装路径

JAVA_BIN=%JAVA_HOME%\bin

PATH=%PATH%;%JAVA_BIN;

classpath:.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar

 maven教程

* 下载安装maven  

http://maven.apache.org/download.cgi

apache-maven-3.3.3-bin.zip

 

* 解压到G:\apache-maven-3.5.3-bin

 

* 添加环境变量

** 添加 M2_HOME 和 MAVEN_HOME 环境变量到 Windows 环境变量,并将其指向你的 Maven 文件夹

** Path环境变量添加 %M2_HOME%\bin

 

* 查看mvn版本

mvn -version

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:05+08:00)
Maven home: G:\apache-maven-3.5.3-bin\bin\..
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_131\jre
Default locale: zh_CN, platform encoding: GBK
OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”

 

* mvn编译打包

** 先把命令行切换到Maven项目的根目录

cd G:\eclipse-workspace\platform\enso-admin

** 编译

 mvn clean compile

  

[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'distributionManagement' (position: START_TAG seen ...</pluginRepositories>\r\n      <distributionManagement>... @304:31)  @ C:\Users\13352\.m2\settings.xml, line 304, column 31
[WARNING]
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.tsinghuadtv.enso:enso-admin:war:1.0
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.codehaus.jackson:jackson-core-asl:jar -> duplicate declaration of version 1.9.12 @ line 156, column 15
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.codehaus.jackson:jackson-mapper-lgpl:jar -> duplicate declaration of version 1.9.12 @ line 161, column 15
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:exec-maven-plugin is missing. @ line 283, column 12
[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] ------------------< com.tsinghuadtv.enso:enso-admin >-------------------
[INFO] Building enso-admin 1.0
[INFO] --------------------------------[ war ]---------------------------------
[WARNING] The POM for commons-logging:commons-logging:jar:1.1.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
Downloading from aliyun-repo: http://maven.aliyun.com/nexus/content/groups/public/com/tflx/enso/service-collection/1.0-SNAPSHOT/maven-metadata.xml
Downloading from aliyun-nexus: http://47.92.133.100:8081/repository/maven-public/com/tflx/enso/service-collection/1.0-SNAPSHOT/maven-metadata.xml
Downloading from alimaven: http://maven.aliyun.com/nexus/content/groups/public/com/tflx/enso/service-collection/1.0-SNAPSHOT/maven-metadata.xml
Downloaded from aliyun-nexus: http://47.92.133.100:8081/repository/maven-public/com/tflx/enso/service-collection/1.0-SNAPSHOT/maven-metadata.xml (1.2 kB at 4.3 kB/s)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ enso-admin ---
[INFO] Deleting G:\eclipse-workspace\platform\enso-admin\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ enso-admin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 28 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ enso-admin ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 323 source files to G:\eclipse-workspace\platform\enso-admin\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.878 s
[INFO] Finished at: 2018-08-03T10:54:39+08:00
[INFO] ------------------------------------------------------------------------

mvn clean compile

 ** 打包

 mvn clean package

  output:

 

[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'distributionManagement' (position: START_TAG seen ...</pluginRepositories>\r\n      <distributionManagement>... @304:31)  @ C:\Users\13352\.m2\settings.xml, line 304, column 31
[WARNING]
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.tsinghuadtv.enso:enso-admin:war:1.0
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.codehaus.jackson:jackson-core-asl:jar -> duplicate declaration of version 1.9.12 @ line 156, column 15
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.codehaus.jackson:jackson-mapper-lgpl:jar -> duplicate declaration of version 1.9.12 @ line 161, column 15
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:exec-maven-plugin is missing. @ line 283, column 12
[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] ------------------< com.tsinghuadtv.enso:enso-admin >-------------------
[INFO] Building enso-admin 1.0
[INFO] --------------------------------[ war ]---------------------------------
[WARNING] The POM for commons-logging:commons-logging:jar:1.1.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ enso-admin ---
[INFO] Deleting G:\eclipse-workspace\platform\enso-admin\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ enso-admin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 28 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ enso-admin ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 323 source files to G:\eclipse-workspace\platform\enso-admin\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ enso-admin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ enso-admin ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 18 source files to G:\eclipse-workspace\platform\enso-admin\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ enso-admin ---
[INFO] Surefire report directory: G:\eclipse-workspace\platform\enso-admin\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (exec-npm-install) @ enso-admin ---
npm WARN admin@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (currup to date in 14.132s
ent: {"os":"win32","arch":"x64"})

[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (exec-npm-run-build) @ enso-admin ---

> admin@1.0.0 build G:\eclipse-workspace\platform\enso-admin\frontend\admin
> node build/build.js

Happy[babel]: Version: 4.0.1. Threads: 3
Happy[babel]: All set; signaling webpack to proceed.
WARN: Output exceeds 32000 characters
WARN: Output exceeds 32000 characters
WARN: Output exceeds 32000 characters
WARN: Output exceeds 32000 characters
WARN: Output exceeds 32000 characters
WARN: Output exceeds 32000 characters
Hash: 7606a9eb6d96668d7d01
Version: webpack 2.5.1
Time: 24456ms
                 Asset       Size  Chunks                    Chunk Names
         1.7606.js.map    1.08 MB       1  [emitted]
             0.7606.js     414 kB       0  [emitted]  [big]
             2.7606.js     343 kB       2  [emitted]  [big]
             3.7606.js     259 kB       3  [emitted]  [big]
             4.7606.js     254 kB       4  [emitted]  [big]
             5.7606.js     155 kB       5  [emitted]
             6.7606.js     153 kB       6  [emitted]
             7.7606.js     162 kB       7  [emitted]
             8.7606.js    22.1 kB       8  [emitted]
             9.7606.js    18.7 kB       9  [emitted]
            10.7606.js    9.64 kB      10  [emitted]
            11.7606.js    11.7 kB      11  [emitted]
            12.7606.js    10.4 kB      12  [emitted]
            13.7606.js    9.49 kB      13  [emitted]
            14.7606.js    3.42 kB      14  [emitted]
            15.7606.js    9.21 kB      15  [emitted]
      cmpt.lib.7606.js     639 kB      16  [emitted]  [big]  cmpt.lib
          main.7606.js     254 kB      17  [emitted]  [big]  main
    cmpt.style.7606.js     170 kB      18  [emitted]         cmpt.style
         0.7606.js.map    1.23 MB       0  [emitted]
             1.7606.js     364 kB       1  [emitted]  [big]
         2.7606.js.map    1.03 MB       2  [emitted]
         3.7606.js.map     744 kB       3  [emitted]
         4.7606.js.map     745 kB       4  [emitted]
         5.7606.js.map     474 kB       5  [emitted]
         6.7606.js.map     466 kB       6  [emitted]
         7.7606.js.map     493 kB       7  [emitted]
         8.7606.js.map    68.1 kB       8  [emitted]
         9.7606.js.map    56.6 kB       9  [emitted]
        10.7606.js.map      30 kB      10  [emitted]
        11.7606.js.map    34.3 kB      11  [emitted]
        12.7606.js.map    32.3 kB      12  [emitted]
        13.7606.js.map    27.6 kB      13  [emitted]
        14.7606.js.map    10.3 kB      14  [emitted]
        15.7606.js.map    27.6 kB      15  [emitted]
  cmpt.lib.7606.js.map    2.61 MB      16  [emitted]         cmpt.lib
      main.7606.js.map     991 kB      17  [emitted]         main
cmpt.style.7606.js.map     198 kB      18  [emitted]         cmpt.style
           favicon.png  839 bytes          [emitted]
            index.html  458 bytes          [emitted]
[INFO]
[INFO] --- maven-war-plugin:3.0.0:war (default-war) @ enso-admin ---
[INFO] Packaging webapp
[INFO] Assembling webapp [enso-admin] in [G:\eclipse-workspace\platform\enso-admin\target\enso-admin-1.0]
[INFO] Processing war project
[INFO] Copying webapp resources [G:\eclipse-workspace\platform\enso-admin\webapp]

mvn clean package

 

 

[INFO] Webapp assembled in [6948 msecs]
[INFO] Building war: G:\eclipse-workspace\platform\enso-admin\target\enso-admin-1.0.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:18 min
[INFO] Finished at: 2018-08-03T10:57:50+08:00
[INFO] ------------------------------------------------------------------------

output…

 ** 部署

 # 根据上一步的输出 把 复制出来

copy G:\eclipse-workspace\platform\enso-admin\target\enso-admin-1.0.war G:\apache-tomcat-7.0.88-windows-x64\webapps\enso-admin.war

G:\apache-tomcat-7.0.88-windows-x64\bin\startup.bat

  

  需要先设置环境变量 CATALINA_HOME

The CATALINA_HOME environment variable is not defined correctly
This environment variable is needed to run this program

set CATALINA_HOME=G:\apache-tomcat-7.0.88-windows-x64

  再试启动tomcat

%CATALINA_HOME%\bin\startup.bat

  

Using CATALINA_BASE: “G:\apache-tomcat-7.0.88-windows-x64”
Using CATALINA_HOME: “G:\apache-tomcat-7.0.88-windows-x64”
Using CATALINA_TMPDIR: “G:\apache-tomcat-7.0.88-windows-x64\temp”
Using JRE_HOME: “C:\Program Files\Java\jdk1.8.0_131”
Using CLASSPATH: “G:\apache-tomcat-7.0.88-windows-x64\bin\bootstrap.jar;G:\apache-tomcat-7.0.88-windows-x64\bin\tomcat-juli.jar”

 ** 配置不对 先停掉tomcat服务

%CATALINA_HOME%\bin\shutdown.bat
del %CATALINA_HOME%\webapps\enso-admin-1.0.war

  

** 修改配置

@doskey n2="C:\Program Files (x86)\Notepad++\notepad++.exe" $* 
n2 %CATALINA_HOME%\conf\server.xml

 

在server.xml文件的 </Host> 闭合标签前面添加一行

<Context docBase="enso-admin" path="/" reloadable="true" source="org.eclipse.jst.jee.server:enso-admin"/>

 

** 再启动

%CATALINA_HOME%\bin\startup.bat

  

** 数据库连接失败

set PROJECT=enso-admin
n2 %CATALINA_HOME%\webapps\%PROJECT%\WEB-INF\classes\jdbc.properties

  

** 浏览器访问

先试试 http://localhost:8080/enso-admin

然后重启tomcat

%CATALINA_HOME%\bin\shutdown.bat
%CATALINA_HOME%\bin\startup.bat

再访问 http://localhost:8080/

 

###############################################

批量获取审批实例ID
https://open-doc.dingtalk.com/microapp/serverapi2/hh8lx5

mvn clean compile -U
mvn clean package -Dmaven.test.skip=true
java -jar target/eapp-corp-project-1.0.0.jar

 

#############################################

JDK 安装

JDK1.8下载与安装

96 小拿_8eef 关注

2018.11.30 10:13 字数 1159 阅读 13770评论 1喜欢 0

之前的文章”jdk版本的选择”中推荐jdk1.8,今天我们就一步一步(视频+图片+文字)带领大家下载和安装。

1.jdk1.8的下载

2.jdk1.8的安装

一、JDK下载

两种方法,第一种是从官网下载;第二种是拿来主义,小拿直接给你网盘地址。不过,作为java新手,最好还是学会去官网下载。

官网下载的文件才是最安全的,从不靠谱第三方下载有可能安装包有缺失或者干脆种点病毒木马神么的。再说,有可能哪天给别人装jdk或者自己升级jdk,找不到网盘地址又得回头点技能点了。

百度(或其它搜索引擎)搜“jdk 下载”,正好第一个就是1.8的下载链接。

 

maven mvn 命令行 编译打包

1. 点击进入下载页

页面地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

目前官方刚对1.8做了一次bug升级,强烈建议使用191或者192的小版本,这里就选择8u191.

 

maven mvn 命令行 编译打包

2. 先选中上方的接受协议,再选择适合自己操作系统的包

我们这里选择最后一个windows64位的安装包,点击红框内右边的jdk-8u191-windows-x64.exe就可以下载了。

二、jdk安装

现在jdk的安装比网上各种文章简单多了,我们来动手搞定它。

1. 双击下载的exe文件,开始安装。如下图,点击下一步。

 

maven mvn 命令行 编译打包

2. 选择jdk的安装目录,建议大家就算不使用默认路径,也放在C盘,除非你的C盘空间告急。

 

maven mvn 命令行 编译打包

3、直接点击下一步,出现下图的告警信息。

只能说最近jdk大版本更新太快了,19年1月官方停止维护。这不是什么大事,1.7早就没有官方管理了,现在依然健在。

直接点“确定”,继续。

 

maven mvn 命令行 编译打包

4.  以为安装结束了?又弹出个窗口,还要选择文件夹,不是安装程序出问题了,仔细一下,安装的不是jdk,是jre。

这部分在“版本选择”文章里也说过,jre是用于运行时的包,是jdk的一部分。

如果没有特殊需求,不需要改变安装目录,点击“下一步”

 

maven mvn 命令行 编译打包

5. 最后,弹窗告诉已成功安装。

 

maven mvn 命令行 编译打包

6. 但是,如果你看过其它的安装文章的话,一定会提到配置“环境变量”。

先说明下配置环境变量的作用,就是让操作系统明确的知道这个程序和它的位置。通常是用在命令行的模式下。windows下点击左下方“开始”按钮,直接输入“cmd”,回车,就能进入命令行界面。

 

maven mvn 命令行 编译打包

7.   输入语句java -version,来看下已经安装的jdk的版本信息。提示java 版本是1.8.0.191,说明安装成功。

 

maven mvn 命令行 编译打包

那就里有个问题,只打了个java命令,系统怎么能反应过来是执行哪个程序呢?这就是环境变量的作用,对配置好的程序,操作系统能自动识别,并找到对应位置的程序来执行。

这就有了另一个问题,明明没有配环境变量,怎么就能执行出结果呢?其实,1.8后的jdk会自动添加环境变量。所以网上那些还要强调配置的文章,要么是老的jdk版本,已经过时了;要么是想当然,没有实际的安装。

那我们来看一下,环境变量里是怎么配置的。在桌面右击“计算机”图标,选择“属性”。

 

maven mvn 命令行 编译打包

点击高级系统设置,在“高级”选项卡,点击下方“环境变量”按钮。

 

maven mvn 命令行 编译打包

通常在path这个字段上添加新的环境变量,双击查看

 

maven mvn 命令行 编译打包

第一个就是java的路径,可以看出已经是配置好了。

 

maven mvn 命令行 编译打包

OK,到这里应该安装就没有什么问题了。

 

jdk1.8 windows 链接: https://pan.baidu.com/s/1-T3KlR_5yd3uF3KBvZeMZg 提取码: 4tum 复制这段内容后打开百度网盘手机App,操作更方便哦

 

Linux JDK 链接: https://pan.baidu.com/s/1vLOkQZK5BONuc0UNILLg1w 提取码: nq66 复制这段内容后打开百度网盘手机App,操作更方便哦

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/134156.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • 如何保证docker2375端口的安全

    如何保证docker2375端口的安全情景再现:之前有很多朋友提过,当使用docker-maven-plugin打包SpringBoot应用的Docker镜像时,服务器需要开放2375端口。由于开放了端口没有做任何安全保护,会引起安全漏洞,被人入侵、挖矿、CPU飙升这些情况都有发生,今天我们来聊聊如何解决这个问题。问题产生的原因首先我们要明白问题产生的原因,才能更好地解决问题!Docker为了实现集群管理,提供了远程管理的端口。DockerDaemon作为守护进程运行在后台,可以执行发送到管理端口上的Docker命令。当我们修改do

  • Java安全之原生readObject方法解读

    Java安全之原生readObject方法解读0x00前言在上篇文章分析shiro中,遇到了Shiro重写了ObjectInputStream的resolveClass导致的一些基于Invoke

    2021年12月12日
  • python psutil替代_python psutil

    python psutil替代_python psutil1、CPU1psutil.cpu_times(percpu=False)返回cpu使用时间元祖。若percpu=True,返回各个CPU的使用情况列表。1psutil.cpu_percent(interval,percpu)#返回CPU利用率2psutil.cpu_times_percent(interval=None,percpu=False)3psutil.cpu_count(lo…

  • java voliate_Java之voliate, synchronized, AtomicInteger使用

    java voliate_Java之voliate, synchronized, AtomicInteger使用1:voliate用在多线程,同步变量。线程为了提高效率,将成员变量(如A)某拷贝了一份(如B),线程中对A的访问其实访问的是B。只在某些动作时才进行A和B的同步。因此存在A和B不一致的情况。volatile就是用来避免这种情况的。volatile告诉jvm,它所修饰的变量不保留拷贝,直接访问主内存中的(也就是上面说的A),但是不能用其来进行多线程同步控制publicclassCounter…

  • [Android-ARCore开发]ARCore从入门到放弃1-Demo上手[通俗易懂]

    Google刚发布了Google ARCore,对标苹果的ARKit,之前微软出hololens的时候就非常关注AR,迫不及待试了一下ARCore的效果,让人Excited,有种刚学安卓时候第一次跑起来模拟器的感觉。顺带记录下上手过程,比较简单,官网很详细,这里差不多只是个翻译。上手准备 1、Android studio 2.3及以上 2、支持的设备Pixel和三星S8 3、官方Demo和AR

  • 百度面试面经[通俗易懂]

    百度面试面经[通俗易懂]作者:球球球offer链接:https://www.nowcoder.com/discuss/230987来源:牛客网看到有帖子说百度的面经少,我发一下面经攒人品,许愿之后的面试都顺利!一共面了两

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号