1

在不同操作系统上创建项目时,在 netbeans +7.2 中编译项目时发生下一个错误

compile-jsps:
    [mkdir] Created dir: /var/lib/jenkins/jobs/workspace/build/generated/src
     [java] Nov 05, 2013 4:47:29 PM org.apache.jasper.runtime.TldScanner scanJar
     [java] WARNING: PWC6351: In TLD scanning, the supplied resource file:/var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/ant.jar;/var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/servlet3.1-jsp2.3-api.jar;/var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/glassfish-jspparser-4.0.jar;/var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/jstl-impl.jar;/var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/javax.faces.jar does not exist
     [java] java.io.FileNotFoundException: /var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/ant.jar;/var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/servlet3.1-jsp2.3-api.jar;/var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/glassfish-jspparser-4.0.jar;/var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/jstl-impl.jar;/var/lib/jenkins/jobs/workspace/lib/jsp-compilation-syscp/javax.faces.jar (No such file or directory)
     [java]     at java.util.zip.ZipFile.open(Native Method)
     [java]     at java.util.zip.ZipFile.<init>(ZipFile.java:214)
     [java]     at java.util.zip.ZipFile.<init>(ZipFile.java:144)
     [java]     at java.util.jar.JarFile.<init>(JarFile.java:152)
     [java]     at java.util.jar.JarFile.<init>(JarFile.java:89)
     [java]     at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:93)
     [java]     at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)
     [java]     at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:88)
     [java]     at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
     [java]     at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
     [java]     at org.apache.jasper.runtime.TldScanner.scanJar(TldScanner.java:442)
     [java]     at org.apache.jasper.runtime.TldScanner.scanJars(TldScanner.java:694)
     [java]     at org.apache.jasper.runtime.TldScanner.scanTlds(TldScanner.java:350)
     [java]     at org.apache.jasper.runtime.TldScanner.getLocation(TldScanner.java:283)
     [java]     at org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:589)
     [java]     at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:500)
     [java]     at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:582)
     [java]     at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1657)
     [java]     at org.apache.jasper.compiler.Parser.parse(Parser.java:185)
     [java]     at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
     [java]     at org.apache.jasper.compiler.ParserController.parse(ParserController.java:145)
     [java]     at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:212)
     [java]     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
     [java]     at org.apache.jasper.JspC.processFile(JspC.java:1171)
     [java]     at org.apache.jasper.JspC.execute(JspC.java:1338)
     [java]     at org.netbeans.modules.web.project.ant.JspC.main(JspC.java:101)
     [java] 
     [java] org.apache.jasper.JasperException: file:/var/lib/jenkins/jobs/workspace/build/web/WEB-INF/auth.jsp(10,61) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
4

1 回答 1

1

这是 Netbeans 如何使用sysClasspath参数调用JspC apache 编译器的问题。您可以在 netbeans错误 #198480上查看 mor 信息

我个人更喜欢将构建系统更改为 Maven,但这是一个庞大而复杂的项目。此外,我不想修改系统生成的文件,如build-impl.xml,所以我更愿意等待将来的 NB 更新和手动更新属性文件会破坏(或修复)某些东西。

我使用自定义 build.xml 修改而不更改 build-impl.xml 来搜索并改进此错误中的解决方案。下一个代码解决了我的问题:

<!-- workaround bug https://netbeans.org/bugzilla/show_bug.cgi?id=198480 -->
<target name="checkos">
    <echo message="OS Name is:         ${os.name}"/>
    <echo message="OS Architecture is: ${os.arch}"/>
    <echo message="OS Version is:      ${os.version}"/>
    <condition property="is_windows">
        <os family="windows"/>
    </condition>
    <condition property="is_linux">
        <os family="unix"/>
    </condition>
</target>
<target name="patch-bug-198480-windows" if="is_windows" depends="checkos">
    <copy file="lib/nblibraries-syscp-windows.properties" tofile="lib/nblibraries-private.properties"/>
</target>
<target name="patch-bug-198480-linux" if="is_linux" depends="checkos">
    <copy file="lib/nblibraries-syscp-linux.properties" tofile="lib/nblibraries-private.properties"/>
</target>

<target name="-post-clean">
    <delete file="lib/nblibraries-private.properties"/>
</target>

    <target name="-pre-init" depends="patch-bug-198480-windows,patch-bug-198480-linux">

我考虑到 libs.jsp-compilation-syscp.claspath 仅在 buidl-impl.xml 的两个地方使用,并且此修改不会改变行为

文件nblibraries-syscp-linux.properties

libs.jsp-compilation-syscp.classpath=\
    ${base}/jsp-compilation-syscp/ant.jar:\
    ${base}/jsp-compilation-syscp/servlet3.1-jsp2.3-api.jar:\
    ${base}/jsp-compilation-syscp/glassfish-jspparser-4.0.jar:\
    ${base}/jsp-compilation-syscp/jstl-impl.jar:\
    ${base}/jsp-compilation-syscp/javax.faces.jar
libs.jsp-compilation-syscp.displayName=JSP Compilation Sysclasspath

文件nblibraries-syscp-windows.properties

libs.jsp-compilation-syscp.classpath=\
    ${base}/jsp-compilation-syscp/ant.jar;\
    ${base}/jsp-compilation-syscp/servlet3.1-jsp2.3-api.jar;\
    ${base}/jsp-compilation-syscp/glassfish-jspparser-4.0.jar;\
    ${base}/jsp-compilation-syscp/jstl-impl.jar;\
    ${base}/jsp-compilation-syscp/javax.faces.jar
libs.jsp-compilation-syscp.displayName=JSP Compilation Sysclasspath

重要提示:您应该记住在 NetBeans 升级时更新这些文件

于 2013-11-06T16:50:32.400 回答