Я получил эту задачу ANT:
<javac verbose="on"
srcdir="${src.dir}"
destdir="${build.dir}/${context.path}/classes"
debug="${compile.debug}"
debuglevel="${javac.debuglevel}"
optimize="${compile.optimize}"
deprecation="${javac.deprecation}"
failonerror="true">
<compilerarg value="-Aeclipselink.persistencexml=${web.dir}/META-INF" compiler="javac1.6" />
<compilerarg line=" -processor org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor" />
<compilerarg line=" -proc:only" compiler="javac1.6" />
<classpath refid="compile.classpath"/>
</javac>
Когда я запустил вышеупомянутое задание, я получил эту ошибку:
[javac] error: java.lang.IllegalArgumentException
[javac] An annotation processor threw an uncaught exception.
[javac] Consult the following stack trace for details.
[javac] java.lang.RuntimeException: java.lang.IllegalArgumentException
[javac] at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:407)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:625)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:554)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:699)
[javac] at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981)
[javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:353)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:279)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:270)
[javac] at com.sun.tools.javac.Main.compile(Main.java:69)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:597)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[javac] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:597)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[javac] at org.apache.tools.ant.Task.perform(Task.java:348)
[javac] at org.apache.tools.ant.Target.execute(Target.java:357)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[javac] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[javac] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[javac] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
[javac] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
[javac] Caused by: java.lang.IllegalArgumentException
[javac] at java.net.URI.create(URI.java:842)
[javac] at com.sun.tools.javac.util.DefaultFileManager.getFileForOutput(DefaultFileManager.java:1029)
[javac] at com.sun.tools.javac.processing.JavacFiler.getResource(JavacFiler.java:434)
[javac] at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.getFileObject(PersistenceUnitReader.java:93)
[javac] at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.getInputStream(PersistenceUnitReader.java:104)
[javac] at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.initPersistenceUnits(PersistenceUnitReader.java:169)
[javac] at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.<init>(PersistenceUnitReader.java:71)
[javac] at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:376)
[javac] ... 31 more
[javac] Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 2: D:\Project\website/WebContent/META-INF
[javac] at java.net.URI$Parser.fail(URI.java:2809)
[javac] at java.net.URI$Parser.checkChars(URI.java:2982)
[javac] at java.net.URI$Parser.parse(URI.java:3019)
[javac] at java.net.URI.<init>(URI.java:578)
[javac] at java.net.URI.create(URI.java:840)
[javac] ... 38 more
Я отследил ошибку до этой строки <compilerarg value="-Aeclipselink.persistencexml=${web.dir}/META-INF" compiler="javac1.6" />
.Похоже, что парсеру не нравится значение аргумента компилятора -Aeclipselink.persistencexml
.Вышеуказанная ошибка воспроизводима как с JDK 1.6.0.24, так и с JDK 1.6.0.25.Ошибка вызвана org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process
.
Я использую EclipseLink версии 2.2.0.v20110202-r8913, которая поставляется в комплекте с Glassfish 3.1.Я также попытался скомпилировать вышеуказанную задачу с помощью автономных библиотек EclipseLink версии 2.2.0.v20110202-r8913 и получил ту же ошибку.
Есть ли обходной путь для вышеуказанной ошибки?