我gradle这个版本是:图像摇篮1.12腐化图像文件
------------------------------------------------------------
Gradle 1.12
------------------------------------------------------------
Build time: 2014-04-29 09:24:31 UTC
Build number: none
Revision: a831fa866d46cbee94e61a09af15f9dd95987421
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Ivy: 2.2.0
JVM: 1.6.0_38-ea (Sun Microsystems Inc. 20.13-b02)
OS: Windows 7 6.1 amd64
的应用程序文件夹的路径是:
myApp\web-app\src\main\webapp\images
通过控制台执行gradle clean deploy
,以下文件夹被分解成我的tomcat部署文件夹,其中包含映像文件:
\myApp\images
部署映像h与我的项目文件相同的名称和完全相同的大小。 唯一的问题是图像损坏,图像失真。有任何想法吗?
更新。下面的代码似乎是resonsible文件损坏:
eachFile {
it.filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
releaseVersion: project.version,
releaseDate: buildDate
])
}
我想,一个可能的解决将是用另一种方式来替换标记。
UPDATE2。 正如有些人提到它,解决方案是将ReplaceTokens过滤器仅应用于某些文件,并跳过某些文件类型。下面的代码工作:
filesNotMatching("**/*.png") {
it.filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
releaseVersion: project.version,
releaseDate: buildDate
])
}
你有什么SSCCE或源代码的某个地方在网络上?可能在复制过程中,文件被复制和处理(过滤)。你在使用过滤器吗? – Opal 2014-10-20 10:18:22
我很害怕我没有一个源代码,你可以看看www。但是,过滤与我的问题有什么关系?该应用程序使用子项目和一个中央build.gradle文件。我看到的唯一过滤类似于:war {archiveName = rootProject.name +“.war” eachFile {it.filter(org.apache.tools.ant.filters.ReplaceTokens,tokens:[ releaseVersion:project .version, releaseDate:buildDate ]) } } – hypercube 2014-10-20 12:08:08
当文件被复制到war文件时,它们可能被过滤,并且二进制内容可能在此时被破坏。 – Opal 2014-10-20 12:09:14