将enabled
设置为false
时,我得到空指针异常(如doc中所述):
<plugin>
<groupId>com.tunyk.mvn.plugins.htmlcompressor</groupId>
<artifactId>htmlcompressor-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>html</goal>
</goals>
</execution>
</executions>
<configuration>
<goalPrefix>htmlcompressor</goalPrefix>
<srcFolder>${basedir}/src/main/webapp/html</srcFolder>
<targetFolder>${basedir}/src/main/webapp/result/html</targetFolder>
<removeIntertagSpaces>true</removeIntertagSpaces>
<enabled>false</enabled>
</configuration>
</plugin>
任何人都知道为什么?有人有解决方案吗?
P.S。:这是maven -X:
[htmlcompressor:html]
com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:jar:1.2:
com.googlecode.htmlcompressor:htmlcompressor:jar:1.4:compile
com.google.javascript:closure-compiler:jar:r1043:compile
args4j:args4j:jar:2.0.12:compile
com.google.guava:guava:jar:r08:compile
com.google.protobuf:protobuf-java:jar:2.3.0:compile
org.apache.ant:ant:jar:1.8.1:compile
org.apache.ant:ant-launcher:jar:1.8.1:compile
com.google.code.findbugs:jsr305:jar:1.3.9:compile
junit:junit:jar:4.8.2:compile
com.yahoo.platform.yui:yuicompressor:jar:2.4.6:compile
rhino:js:jar:1.6R7:compile
javax.servlet.jsp:jsp-api:jar:2.1:compile
org.apache.velocity:velocity-tools:jar:2.0:compile
commons-beanutils:commons-beanutils:jar:1.7.0:compile
commons-digester:commons-digester:jar:1.8:compile
commons-chain:commons-chain:jar:1.1:compile
commons-collections:commons-collections:jar:3.2:compile
commons-logging:commons-logging:jar:1.1:compile
javax.servlet:servlet-api:jar:2.3:compile
commons-validator:commons-validator:jar:1.3.1:compile
dom4j:dom4j:jar:1.1:compile
oro:oro:jar:2.0.8:compile
sslext:sslext:jar:1.2-0:compile
org.apache.struts:struts-core:jar:1.3.8:compile
antlr:antlr:jar:2.7.2:compile
org.apache.struts:struts-taglib:jar:1.3.8:compile
org.apache.struts:struts-tiles:jar:1.3.8:compile
org.apache.velocity:velocity:jar:1.6.2:compile
commons-lang:commons-lang:jar:2.4:compile
org.apache.commons:commons-io:jar:1.3.2:compile
org.json:json:jar:20090211:compile
org.apache.maven:maven-plugin-api:jar:3.0.3:compile
org.apache.maven:maven-model:jar:3.0.3:compile
org.codehaus.plexus:plexus-utils:jar:2.0.6:compile
org.apache.maven:maven-artifact:jar:3.0.3:compile
org.sonatype.sisu:sisu-inject-plexus:jar:2.1.1:compile
org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
org.codehaus.plexus:plexus-classworlds:jar:2.4:compile
org.sonatype.sisu:sisu-inject-bean:jar:2.1.1:compile
org.sonatype.sisu:sisu-guice:jar:no_aop:2.9.4:compile
org.slf4j:slf4j-api:jar:1.5.10:compile
org.slf4j:slf4j-log4j12:jar:1.5.10:compile
log4j:log4j:jar:1.2.14:compile
Created new class realm plugin>com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2
Importing foreign packages into class realm plugin>com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2
Imported: < maven.api
Populating class realm plugin>com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2
Included: com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:jar:1.2
Included: com.googlecode.htmlcompressor:htmlcompressor:jar:1.4
Included: com.google.javascript:closure-compiler:jar:r1043
Included: args4j:args4j:jar:2.0.12
Included: com.google.guava:guava:jar:r08
Included: com.google.protobuf:protobuf-java:jar:2.3.0
Included: org.apache.ant:ant:jar:1.8.1
Included: org.apache.ant:ant-launcher:jar:1.8.1
Included: com.google.code.findbugs:jsr305:jar:1.3.9
Included: junit:junit:jar:4.8.2
Included: com.yahoo.platform.yui:yuicompressor:jar:2.4.6
Included: rhino:js:jar:1.6R7
Included: javax.servlet.jsp:jsp-api:jar:2.1
Included: org.apache.velocity:velocity-tools:jar:2.0
Included: commons-beanutils:commons-beanutils:jar:1.7.0
Included: commons-digester:commons-digester:jar:1.8
Included: commons-chain:commons-chain:jar:1.1
Included: commons-collections:commons-collections:jar:3.2
Included: commons-logging:commons-logging:jar:1.1
Included: javax.servlet:servlet-api:jar:2.3
Included: commons-validator:commons-validator:jar:1.3.1
Included: dom4j:dom4j:jar:1.1
Included: oro:oro:jar:2.0.8
Included: sslext:sslext:jar:1.2-0
Included: org.apache.struts:struts-core:jar:1.3.8
Included: antlr:antlr:jar:2.7.2
Included: org.apache.struts:struts-taglib:jar:1.3.8
Included: org.apache.struts:struts-tiles:jar:1.3.8
Included: org.apache.velocity:velocity:jar:1.6.2
Included: commons-lang:commons-lang:jar:2.4
Included: org.apache.commons:commons-io:jar:1.3.2
Included: org.json:json:jar:20090211
Included: org.codehaus.plexus:plexus-utils:jar:2.0.6
Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
Included: org.sonatype.sisu:sisu-inject-bean:jar:2.1.1
Included: org.sonatype.sisu:sisu-guice:jar:no_aop:2.9.4
Included: org.slf4j:slf4j-api:jar:1.5.10
Included: org.slf4j:slf4j-log4j12:jar:1.5.10
Included: log4j:log4j:jar:1.2.14
Excluded: org.apache.maven:maven-plugin-api:jar:3.0.3
Excluded: org.apache.maven:maven-model:jar:3.0.3
Excluded: org.apache.maven:maven-artifact:jar:3.0.3
Excluded: org.sonatype.sisu:sisu-inject-plexus:jar:2.1.1
Excluded: org.codehaus.plexus:plexus-classworlds:jar:2.4
Configuring mojo com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2:html from plugin realm ClassRealm[plugin>com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2, parent: sun.misc.Launcher$AppClassLoader@11b86e7]
Configuring mojo 'com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2:html' with basic configurator -->
(s) closureCustomExternsOnly = false
(s) closureExterns = []
(s) closureOptLevel = simple
(s) compressCss = false
(s) compressJavaScript = false
(s) enabled = false
(s) encoding = utf-8
(s) fileExt = []
(s) generateStatistics = true
(s) htmlCompressionStatistics = C:\Users\...\Documents\Java\NewBigBag\Convert-Kit\trunk\target/htmlcompressor/html-compression-statistics.txt
(s) javascriptHtmlSprite = true
(s) javascriptHtmlSpriteIntegrationFile = C:\Users\...\Documents\Java\NewBigBag\Convert-Kit\trunk/src/main/resources/html/integration.js
(s) javascriptHtmlSpriteTargetFile = C:\Users\JVerstry\Documents\Java\NewBigBag\Convert-Kit\trunk\target/htmlcompressor/html/integration.js
(s) jsCompressor = yui
(s) predefinedPreservePatterns = []
(s) preservePatternFiles = []
(s) preservePatterns = []
(s) removeComments = true
(s) removeFormAttributes = false
(s) removeHttpProtocol = false
(s) removeHttpsProtocol = false
(s) removeInputAttributes = false
(s) removeIntertagSpaces = true
(s) removeJavaScriptProtocol = false
(s) removeLinkAttributes = false
(s) removeMultiSpaces = true
(s) removeQuotes = false
(s) removeScriptAttributes = false
(s) removeStyleAttributes = false
(s) simpleBooleanAttributes = false
(s) simpleDoctype = false
(s) srcFolder = C:\Users\...\Documents\Java\NewBigBag\Convert-Kit\trunk/src/main/webapp/html
(s) targetFolder = C:\Users\...\Documents\Java\NewBigBag\Convert-Kit\trunk/src/main/webapp/result/html
(s) yuiCssLineBreak = -1
(s) yuiJsDisableOptimizations = false
(s) yuiJsLineBreak = -1
(s) yuiJsNoMunge = false
(s) yuiJsPreserveAllSemiColons = false
-- end configuration --
Compressing C:\Users\...\Documents\Java\NewBigBag\Convert-Kit\trunk/src/main/webapp/html
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2:01.151s
Finished at: Sun Jan 29 11:55:23 CET 2012
Final Memory: 16M/47M
------------------------------------------------------------------------
Failed to execute goal com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2:html (default) on project convertkit: Execution default of goal com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2:html failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2:html (default) on project convertkit: Execution default of goal com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2:html failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal com.tunyk.mvn.plugins.htmlcompressor:htmlcompressor-maven-plugin:1.2:html failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.NullPointerException
at com.tunyk.mvn.plugins.htmlcompressor.HtmlCompressorMojo.execute(HtmlCompressorMojo.java:417)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
答案 0 :(得分:2)
这是htmlcompressor-maven-plugin的错误。 该修复程序已经提交,并且已于2月5日安排发布1.3版本。 在版本1.3中,您将看到消息“HTML压缩已关闭”。或“XML压缩已关闭。”如果属性“enabled”设置为false。