突然之前我的Liferay主题编译好了,开始在Ant构建上产生异常。
例外情况如下:
compile:
[java] java.lang.NullPointerException
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:601)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:601)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
[java] at net.sf.antcontrib.logic.ForTask.doSequentialIteration(ForTask.java:259)
[java] at net.sf.antcontrib.logic.ForTask.doToken(ForTask.java:268)
[java] at net.sf.antcontrib.logic.ForTask.doTheTasks(ForTask.java:324)
[java] at net.sf.antcontrib.logic.ForTask.execute(ForTask.java:244)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:601)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
[java] at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:601)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:601)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:390)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:411)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[java] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
[java] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
[java] Caused by: java.lang.NullPointerException
[java] at java.io.File.<init>(File.java:251)
[java] at com.liferay.portal.tools.ThumbnailBuilder.main(ThumbnailBuilder.java:33)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:601)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] ... 51 more
[java] Java Result: -1
任务,生成此异常可能跟随
<java
classname="com.liferay.portal.tools.ThumbnailBuilder"
classpathref="portal.classpath">
<arg value="thumbnail.original.file=@{file}" />
<arg value="thumbnail.thumbnail.file=${thumbnail.file}" />
<arg value="thumbnail.height=120" />
<arg value="thumbnail.width=160" />
<arg value="thumbnail.overwrite=false" />
</java>
项目中可能发生了哪些变化,以便开始生成此异常?
更新
添加了回声
<sequential>
<propertyregex input="@{file}" override="yes" property="thumbnail.file" regexp="screenshot\.png" replace="thumbnail\.png" />
<echo> file @{file} </echo>
<echo> thumbnail.file ${thumbnail.file} </echo>
<java
classname="com.liferay.portal.tools.ThumbnailBuilder"
classpathref="portal.classpath"
>
<arg value="thumbnail.original.file=@{file}" />
<arg value="thumbnail.thumbnail.file=${thumbnail.file}" />
<arg value="thumbnail.height=120" />
<arg value="thumbnail.width=160" />
<arg value="thumbnail.overwrite=false" />
</java>
</sequential>
并发现,这两个文件都很好并且存在。