byzy / jcv-maven-plugin

jcv-maven-plugin是一个自动为网页添加js/css的版本号和自动化压缩js/cssmaven插件,支持多种方法版本号添加,采集文件的md5值进行文件版本号修订,这个可以在每次更新的时候只修改以修改的文件的版本号,消除浏览器js/css缓存问题,同时避免使用全局版本号的方式,使得全部js/css缓存失效.
https://www.iqarr.com/2018/02/20/java/maven/jcv-maven-plugin/
Apache License 2.0
34 stars 15 forks source link

使用dos命令行打包无法将html文件打入包中 #3

Closed yuruixin closed 6 years ago

yuruixin commented 6 years ago

插件用了半年了,方便了工作,先表示感谢! 最近写了批处理,在dos中用mvn package打包时,发现html文件无法打入包中。但是在idea中是可以的,请问是不支持外部打包么?

byzy commented 6 years ago

和命令行无关,能提供pom和bat吗?

yuruixin commented 6 years ago

测试demo源码地址:https://github.com/yuruixin/jcv-demo.git

以该demo为例,使用idea与命令行的方式,分别打包测试 项目中共三个不同格式的文件:html、jsp、ftl 分别在以下目录:

\src\main\webapp\web\html
\src\main\webapp\WEB-INF\views
\src\main\webapp\WEB-INF\views-ftl

使用idea打包(打包正常): demo.html 这里写图片描述 demo.jsp 这里写图片描述 demo.ftl 这里写图片描述

使用命令行打包(打包异常,ftl、html文件未打入包中):

mvn clean package

使用命令行,只用jsp文件是成功的

这里写图片描述

byzy commented 6 years ago

pom添加 <packaging>war</packaging>

yuruixin commented 6 years ago

添加后,复测,问题还是存在。代码已同步至git仓库。劳烦抽空看下

byzy commented 6 years ago

还有一种可能,你电脑cmd下mvn版本过低,我记得3以前的不支持list配置 ,可以提供打包时候输出截图? jcv那块的

yuruixin commented 6 years ago
D:\Documents\jcv--demo\demo>mvn clean package
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.jcv.version:demo:war:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 15, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ line 26, 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] ------------------------------------------------------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ demo ---
[INFO] Deleting D:\Documents\jcv--demo\demo\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- jcv-maven-plugin:1.0.2:process (process) @ demo ---
[INFO] =================================JCV====================================
[INFO]       _  _______      __
[INFO]      | |/ ____\ \    / /
[INFO]      | | |     \ \  / /
[INFO]  _   | | |      \ \/ /
[INFO] | |__| | |____   \  /
[INFO]  \____/ \_____|   \/
[INFO]
[INFO]
[INFO] find suffixs size:1
[INFO] build sourceEncoding:UTF-8
[INFO] out Dir:D:\Documents\jcv--demo\demo\target\demo-1.0-SNAPSHOT
[INFO] system is linux:false
[INFO] css method is :MD5_METHOD
[INFO] js method is :MD5_METHOD
[INFO] build webRootName:demo-1.0-SNAPSHOT
[INFO] web app Dir:D:\Documents\jcv--demo\demo\src\main\webapp
[INFO] --------------------------------- process success file size: 2
[INFO] ===============  Total time [51 millisecond]===========================
[INFO] ========================================================================
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Documents\jcv--demo\demo\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ demo ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:3.1.0:war (default-war) @ demo ---
[INFO] Packaging webapp
[INFO] Assembling webapp [demo] in [D:\Documents\jcv--demo\demo\target\demo-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Documents\jcv--demo\demo\src\main\webapp]
[INFO] Webapp assembled in [507 msecs]
[INFO] Building war: D:\Documents\jcv--demo\demo\target\version-demo.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.965 s
[INFO] Finished at: 2018-06-26T11:31:29+08:00
[INFO] Final Memory: 11M/180M
[INFO] ------------------------------------------------------------------------

D:\Documents\jcv--demo\demo>mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
Maven home: D:\tools\apache-maven-3.3.3
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: D:\Program Files\Java\jdk1.8.0_111\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
yuruixin commented 6 years ago

看了下 mvn应该是3.3.3的版本

byzy commented 6 years ago

考虑升级下mvn版本?日志显示只取了默认的后缀 find suffixs size:1

yuruixin commented 6 years ago

版本升级至3.3.9完美解决,多谢 这么好的工具,可以在gitee也挂一个项目,申请个GVP计划 貌似红薯还在你博客下邀请过你,不知你看没看到