I am developing a Web Service, built on Java 8. I am trying to determine how to overcome a common Maven error, but with a slight twist. Running the mvn install
goal works perfectly, without any errors. My web service successfully builds and runs. It is only when trying to perform the site:deploy
goal that I run into issues.
I have narrowed down the issue to the JMS 2.0 simplified API. Or more accurately, there is an issue where the streams-aq dependency I am using is not aware of the newer simplified API that was released with JMS 2.0 back in 2013. At least that is what appears to be happening. There is also a potential issue with the version of Spring being used. Regardless, the Spring / JMS dependencies that are imported are not aware of the JMS Context object.
When I try to create a Context object in code there isn't a problem running it. Yet when Maven's site-deploy attempts to compile the underlying dependencies (to build all of the JavaDocs used in the site documentation), I get the following error message:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/{path}/src/main/java/org/name/config/JmsConfigurationComp.java:[75,46] cannot find symbol
symbol: method createContext()
location: interface javax.jms.ConnectionFactory
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.037 s
[INFO] Finished at: 2019-09-16T19:31:17-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.7.1:site (default-site) on project testProject: failed to get report for org.apache.maven.plugins:maven-javadoc-plugin: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project testProject: Compilation failure
[ERROR] /C:/{path}/src/main/java/org/name/config/JmsConfigurationComp.java:[75,46] cannot find symbol
[ERROR] symbol: method createContext()
[ERROR] location: interface javax.jms.ConnectionFactory
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
QUESTION: There should be a way to exclude just the javax.jms.ConnectionFactory class, so that Maven does not try to compile it. I do not need the ConnectionFactory in my JavaDocs. I really don't need any of the JMS API docs in my documentation.
Since the code runs flawlessly, it seems ridiculous to be blocked simply by Maven's inability to build JavaDocs for an external class for which it cannot resolve! Especially when it is a valid method that the Java compiler has no trouble finding! ;-)
I have tried a number of exclude commands in my POM file, but none of them seem to have worked. I don't want to risk swaying any of you fine engineers from offering a solution that you think I have already tried, so I won't waste space here with a list of POM code blocks. If you have ran into an issue similar to this, please take a moment and give any suggestions or examples that worked for you.