When running 'maven install', I get the following..
[INFO] [javadoc:javadoc {execution:
default}] [INFO]
------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO]
------------------------------------------------------------------------ [INFO] An error has occurred in
JavaDocs report generation:Exit code:
1 - java.lang.NullPointerException
at com.sun.tools.doclets.formats.html.PackageUseWriter.generatePackageUse(PackageUseWriter.java:180)
at com.sun.tools.doclets.formats.html.PackageUseWriter.generatePackageList(PackageUseWriter.java:124)
at com.sun.tools.doclets.formats.html.PackageUseWriter.generatePackageUse(PackageUseWriter.java:110)
at com.sun.tools.doclets.formats.html.PackageUseWriter.generatePackageUseFile(PackageUseWriter.java:99)
at com.sun.tools.doclets.formats.html.PackageUseWriter.generate(PackageUseWriter.java:78)
at com.sun.tools.doclets.formats.html.ClassUseWriter.generate(ClassUseWriter.java:116)
at com.sun.tools.doclets.formats.html.HtmlDoclet.generateOtherFiles(HtmlDoclet.java:92)
at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:122)
at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
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 com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:41)
at com.sun.tools.javadoc.Main.main(Main.java:31)
Command line was: /home/fsl/jdk1.6.0_12/jre/../bin/javadoc #options #packages #argfile
What am I doing wrong?
Also, if you have:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:jar (default-cli) on project coolproject-api: MavenReportException: Error while creating archive:
[ERROR] Exit code: 1 - javadoc: warning - No source files for package org.coolproject.api
[ERROR] javadoc: warning - No source files for package org.coolproject.api
[ERROR] javadoc: warning - No source files for package org.coolproject.api.listeners
[ERROR] javadoc: error - No public or protected classes found to document.
Java compiler understands sources directories with package-style names like:
coolproject-api/java/org.coolproject.api/
and there are no problems with it, but maven-javadoc-plugin doesn't. So try to change your "physical" packages layout to:
coolproject-api/java/org/coolproject/api/
To drop the -use option in maven-javadoc-plugin, use the following configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<use>false</use>
<links>
<link>http://java.sun.com/javase/6/docs/api/</link>
</links>
</configuration>
</plugin>
There is an unfixed bug that seems to be your problem. From the bug description the known workarounds are either to drop the -use option or use JDK 1.4.2. You're using Java 6 so this may be the case.
The line the NullPointerException is occuring at is:
printHyperLink("", pkg.name(), Util.getPackageName(pkg), true);
So perhaps the problem is occurring because of a typo in your package.html file?
From that bug report, this will occur when one has classes in the default package and -use is on. So one solution is to move the classes in the default package into a named package.
Annoying that this bug hasn't been fixed in the javadoc tool distributed with some of the distributions, such as MacOS X Lion.
The bug appears to have been fixed in the openjdk 6, at least from inspection of the source code. Download of that source available at: http://download.java.net/openjdk/jdk6/
Look at your environment variables and delete the CLASSPATH variable or add your package path.
javadoc uses the classpath to determine the packages. If the path is not in your variable it will fail.
Related
I think the problem is the same as described in this blog post but I get this for Java 10: I have an Eclipse RCP application that uses Java 10 features but also JAXB classes. In Eclipse, I have to add the java.xml.bind module to the build path configuration of my project (as described here) to let the compile errors go away.
However, when building the product with Tycho 1.2.0 I get the following error, exactly for the class that uses JAXB:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.2.0:compile (default-compile) on project epd-editor: Compilation failure: Compilation failure:
[ERROR] ...app\src\app\editors\XmlPage.java:
[ERROR] package app.editors;
[ERROR] ^
[ERROR] Internal compiler error: java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.lookup.BinaryModuleBinding.create(BinaryModuleBinding.java:64)
[ERROR] java.lang.NullPointerException
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.BinaryModuleBinding.create(BinaryModuleBinding.java:64)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getModuleFromAnswer(LookupEnvironment.java:427)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForTypeFromModules(LookupEnvironment.java:367)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:228)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:105)
Is there a way to configure the Tycho compiler plugin so that it can see modules like java.xml.bind or is there another reason for this error?
Thanks.
Java EE modules are deprecated for removal and not resolved by default and will be removed in Java 11.
The best way to handle this is to use a third-party dependency, but as you observe JDT trips over its own feet when that is done. I opened an issue and it was fixed some time ago, but it's not easy to find an artifact that contains the change and works on Java 10. The first artifact I know of comes from Eclipse Photon I20180531-0700.
Execute the following in Eclipse's plugins folder (#people from the future: you may have to update the version):
mvn install:install-file \
-Dfile=org.eclipse.jdt.core_3.14.0.v20180528-0519.jar \
-DgroupId=org.eclipse.tycho \
-DartifactId=org.eclipse.jdt.core \
-Dversion=3.14.0.v20180528-0519 \
-Dpackaging=jar
You can then use it as follows as dependencies for Maven's compiler plugin:
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-jdt</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<!-- unreleased version that was pulled from Eclipse Photon I20180531-0700
contains the fix and compiles Java 10 -->
<version>3.14.0.v20180528-0519</version>
</dependency>
The problem is also described on java9.wtf with a demo project on GitHub. (I forgot to push, so it's only online for about five minutes now. 😒)
There are three ways you can include modules from the java.se.ee aggregator module, which is not included for compile or runtime in JDK 10. (As of JDK 11, these modules will be removed from the JDK).
The simplest is to use the command line option, --add-modules java.xml.bind. This will use the version that is still included in the JDK.
Find a JAXB implementation jar. Maven central is a good place to go for this, there is also a reference implementation for JSR 222 (JAXB), which is part of the Java Web Services Developer Pack (http://www.oracle.com/technetwork/java/webservicespack-jsp-140788.html) but this is waaaay old and may not be the best choice. You can add where you've downloaded the jar to the upgrade module path using --upgrade-module-path {path}
An alternative to 2 is to simply put the jar containing JAXB on the classpath.
I'm not familiar with Tycho but you would need to figure out how to use one of these methods with its configuration.
I use Intellij Idea 2017.3 (Ultimate Edition) to build an artifact (an executable Jar) from a Scala/SBT project; Scala version is 2.12.
Since I have added a dependency to Scallop recently, I can no longer execute the Jar file because the Scallop class ScallopConf is not in the Jar file:
$ java -jar executable.jar
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/rogach/scallop/ScallopConf
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
[...]
Caused by: java.lang.ClassNotFoundException: org.rogach.scallop.ScallopConf
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 19 more
I can confirm that the ScallopConf class is not packaged into the Jar file by inspecting it manually. All other dependencies are there, no matter if they were added initially or later.
This is how I added the dependency to the build.sbt file in the project root directory:
libraryDependencies += "org.rogach" %% "scallop" % "3.1.1"
The project compiles fine both within the IDE and with sbt compile. I can also run it fine within the IDE.
I created the artifact within the IDE in a standard way. Is there anything particular I need to pay attention to, possibly related to Scallop?
As pointed out by #Andrey , the artifact settings are not automatically updated when the SBT dependencies change. To make sure everything is up-to-date, the workaround is hence to re-create the artifact after updating the SBT dependencies.
So this issue is not related to the specific dependency (Scallop in this case).
Conflicts are happening between class files of jars, therefore in the above example when libraries are removed from File | Project Structure | Artifacts | Output Layout . Everything runs fine.
In my case I had dependencies on other jars as well, so when I did this activity of removing all other libraries. ClassNotFoundException was gone but NoClassFoundEx is coming for dependent libraries which I removed.
In order to get to the exact solution I am forced to evaluate all the jar files one by one and removed unwanted libraries to get to the exact solution.
Attempting to sbt compile a branch of my project ENSIME (experiment if you're interested) under Java 6 is giving a bizarre compiler warning:
[info] Compiling 48 Scala sources to /home/fommil/Projects/ensime-server/target/scala-2.11/classes...
[error] Class java.lang.invoke.MethodHandle not found - continuing with a stub.
[error] two errors found
[error] (compile:compile) Compilation failed
[error] Total time: 18 s, completed 03-Sep-2014 22:57:44
It works under Java 7.
Calling last reveals nothing more than the classpath of the compile (this would be equivalent to setting --debug level).
I've removed all the plugins from the project, and the problem still shows.
If I remove all my code - leaving just the build system and dependencies - with some stub scala entry points then there is no problem.
However, I can't exactly bisect my source code file because then it doesn't compile.
When the code is compiled, a grep (including binaries) of MethodHandle doesn't give any hits (although there is a jdk8 file in the tests resources, it is not relevant because the problem appears if it is removed).
It is only one (big) patch that has caused the problem (the previous commit compiles ok).
How can I debug this further in sbt? it doesn't want to give any more info
is this a known problem, or can anyone make an informed guess what is going on?
It turns out that this was caused by pulling in Lucene, which requires Java 7.
A bit of an epic message fail from sbt: there doesn't appear to be any way to get it to output anything sensible.
I have an error compiling my app:
[INFO] Compiling module com.mycompany.myapp.MyAppMocked
[INFO] Finding entry point classes
[INFO] [ERROR] Unable to find type 'com.mycompany.myapp.client.mock.MockEntryPoint'
[INFO] [ERROR] Hint: Check that the type name 'com.mycompany.myapp.client.mock.MockEntryPoint' is really what you meant
[INFO] [ERROR] Hint: Check that your classpath includes all required source roots
In my .gwt.xml, I have:
<entry-point class="com.mycompany.myapp.client.mock.MockEntryPoint" />
The problem occurs when I put MockEntryPoint.java in src/mocked/java instead of src/main/java.
I need to have both directories to exclude everything in src/mocked/java when compiling the "no-mock" version.
If I move MockEntryPoint.java to src/main/java, the compilation will succeed with no error. In both cases, the class MockEntryPoint is in the package "com.mycompany.myapp.client.mock".
How can I tell gwt to look for my entry class in src/mocked/java?
Assuming this is a Maven project, you need to add src/mocked/java as a source folder. In Maven, it has to be done using the build-helper-maven-plugin's add-source mojo.
But there's little to no reason to have that src/mocked hierarchy:
you can put everything in src/main and just compile the GWT module you need/want (set the module or modules configuration property for the gwt-maven-plugin accordingly)
if you want them clearly separated, Maven wants you to use distinct Maven modules/projects. You don't want to fight against Maven.
Replace statement <source path='main'/> with <source path='mocked'/> in your .gwt.xml
Then compiler will know which directory to choose for compilation.
I hope it helps.
I'm trying to start using GWTQuery in a GWT project.
I've created sample GWT project in Eclipse
Added gwtquery-1.3.2.jar
into war/WEB-INF/lib
Edited Myproject.gwt.xml (added <inherits name='com.google.gwt.query.Query'/>)
When I compile the project it writes a lot of deffered errors but at the end it comes with:
Scanning for additional dependencies: jar:file:/C:/eclipseBacklog/Backlog/war/WEB-INF/lib/gwtquery-1.3.2.jar!/com/google/gwt/query/client/GQuery.java
Computing all possible rebind results for 'com.google.gwt.query.client.GQuery'
Rebinding com.google.gwt.query.client.GQuery
Checking rule <replace-with class='com.google.gwt.query.client.impl.SelectorEngineNativeIE8'/>
[ERROR] Errors in 'jar:file:/C:/eclipseBacklog/Backlog/war/WEB-INF/lib/gwtquery-1.3.2.jar!/com/google/gwt/query/client/Properties.java'
[ERROR] Line 20: The import com.google.gwt.core.shared cannot be resolved
[ERROR] Line 39: GWT cannot be resolved
[ERROR] Unable to find type 'com.google.gwt.query.client.GQuery'
[ERROR] Hint: Previous compiler errors may have made this type unavailable
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] Errors in 'jar:file:/C:/eclipseBacklog/Backlog/war/WEB-INF/lib/gwtquery-1.3.2.jar!/com/google/gwt/query/client/GQuery.java'
[ERROR] Line 1483: Failed to resolve 'com.google.gwt.query.client.GQuery' via deferred binding
What I'm doing wrong?
Check your version of gwt, you have to update to GWT-2.5.x. because this artifact of gquery has a undesired dependency of it. There are two GWT.java classes in 2.5, and gquery is depending of the new com.google.gwt.core.shared by mistake.
Open an issue at the gwtquery site becasuse this release should work with older gwt version as well.
You could also change the gquery version to 1.3.1 or 1.4.0-SNAPSHOT
Update: I've just deprecated version 1.3.2, and released 1.3.3 which compiles with previous gwt versions