I use maven (3.2.1) to build our project. My project depends on some propretiary libraries that we have in local maven repo. Those libraries are declared with provided scope (because we don't need them in distribution). Our dependencies depends, of course, on some other libs, e.g. apache-scxml lib, but our code don't do anything with any class from apache-scxml. And in JDK8u20 we cannot build our system anymore, it fails with exception:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project <myproject>: Compilation failure
[ERROR] <myclass>.java:[47,45] error: cannot access SCXMLListener
But project builds completely fine with JDK8u5 and JDK8u11.
I tried to find some info and only thing I found is here: https://issues.jboss.org/browse/FORGE-2019
but I don't think its the same, or at least I cannot understand it. Can someone explain to me what can be the reason that it compiles with JDK8u11 and not with u20?
Related
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.
I resolved the issue. After reading through this excellent article that identifies an extensive list of causes that would result in the ("Cannot find symbol" compilation error) thrown by Maven, I realized that my attempts to exclude the unlocatable class was not the solution. #khmarbaise communicated a similar sentiment.
I resolved the compilation issue by explicitly defining version 2.0 of the JMS API as a Maven dependency in my project POM file. Previously only JMS 1.1 was resolving.
I erroneously stated that it was there already, but because version 1.1 was being inherited from an internal project that included streams-aq (and subsequently JMS), only version 1.1 of the JMS API was available.
Once JMS version 2.0 was properly defined, Maven was able to find the missing JMS 2.0 methods, and successfully compile the sources into the JavaDocs for the service. It had also been misleading because the Java code had no problem locating the methods in question.
I'm attempting to build two Maven projects from Eclipse. One project constitutes a set of dependencies and libraries to be used for the other project which contains all of my source code. Both are configured as Maven projects using Tycho 1.0.0 .
I have a parent POM file that contains three modules: a folder containing my target file, the plugin containing the dependencies and the plugin that contains the source code. When trying to maven build on the parent POM, I get the following error:
Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile (default-compile) on project com.ericsson.cd-editor.ui: Execution default-compile of goal org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile failed: A required class was missing while executing org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile: freemarker/template/Configuration
Gonna post the full error log in pastebin since it's diffcult to read in a Stack Overflow post:
http://pastebin.com/EYnsqvpJ
Here is my parent POM file:
http://pastebin.com/wSAtwspV
I've been told by a colleague of mine that the reason this might be happening is that this dependency might be used by Tycho and cannot be found. The freemarker package is however available in my .m2/repository/.
It's really hard to tell where the error might be.
First, make sure the jar you have in your m2 archive actually contains the class the compiler is looking for.
You could check whether you dependencies are in the central maven repository, instead of making a project containing them.
Does the project that needs all the dependencies state them explicitly, e.g., in feature.xml or Manifest.mf? Otherwise tycho will not load them, even if they are accessible to maven.
Posting the pom.xml files for the modules might be helpful. Hope you'll figure it out :)
We have the next project structure:
parentPom.xml
java projects
streambase projects
streambaseParentPom.xml
project1
project2 (has dependency of project1)
So we have a parentPom with inherits to streambaseParentPom and last one inherit to all streambase projects.
So, we make attemp to have in parentPom a properti called cerebro.version which define the version for parent.
We're getting issues when we have project1 as dependency of other projects, we're getting next error message:
[ERROR] Failed to execute goal on project eFX-SB7-Pricing: Could not resolve dependencies for project com.santander.fx:eFX-SB7-Pricing:jar:3.14.10.0.4-SNAPSHOT:
Failed to collect dependencies at com.santander.fx:eFX-SB7-Common:jar:3.14.10.0.4-SNAPSHOT:
Failed to read artifact descriptor for com.santander.fx:eFX-SB7-Common:jar:3.14.10.0.4-SNAPSHOT:
Could not transfer artifact com.santander.fx:eFX-SB7-Parent:pom:${cerebro.version} from/to eFX-External-Repository (http://lnx-efxbuild2.ants.ad.anplc.co.uk:8081/artifactory/ext-release-local):
Illegal character in path at index 109: http://lnx-efxbuild2.ants.ad.anplc.co.uk:8081/artifactory/ext-release-local/com/santander/fx/eFX-SB7-Parent/${cerebro.version}/eFX-SB7-Parent-${cerebro.version}.pom -> [Help 1]
Thanks in advance.
I am afraid it doesn't work like that. It is a bad idea to parameterize the <version> value since even if you managed to deploy it to your remote repo, any project using that artifact later on wouldn't have a clue what ${cerebro.version} should resolve to.
Remember, Maven works hard to keep your builds reproducible. If the build is dependent on some variable that was known at deploy time, but unknown for dependents, your build will no longer be reproducible.
I am trying to compile picketlink from source but it keeps failing with the same error when running either mvn install or mvn package.
It always fails on 'PicketLink Identity Management API' with the error
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project picketlink-idm-api: Compilation failure
error: java.lang.NullPointerException
I have tried with versions 2.5.0, 2.5.1, 2.5.2, 2.6.0, and 2.6.1.
Whats wrong and how can I fix this?
Thanks
You can try to compile using a web archive (war) package? It also might help to start a new project with just the one dependency. It might help you narrow down the problem.
I'm attempting to start a fresh project that hopes to use GWT 1.7.1, the Google Plugin for Eclipse, and Maven 2. I inferred that the best way to do this would be to setup the project using the Mojo gwt-maven-plugin's archetype from this question.
All was going well until I attempted a build. The archetype adds a generateAsync goal, and Maven is reporting that it doesn't know what that goal's default phase should be.
11/30/09 9:09:53 AM EST: Build errors for your-artifact-name-here; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to construct build plan for: gwt-maven-archetype-project
Id: com.crowehorwath:licensing-forms-gwt:war:0.0.1-SNAPSHOT
task-segment: [process-test-resources]. Reason: Failed to load plugin descriptor for: org.codehaus.mojo:gwt-maven-plugin:1.1-SNAPSHOT:generateAsync. Cannot discover it's default phase, specified in its plugin descriptor.
Any ideas? Hopefully I'm missing something simple.
Try version 1.1 of the gwt-maven-plugin instead of 1.1-SNAPSHOT.
Try running from the command line using Maven if you have not done so already.
The following jira might help as well: http://jira.codehaus.org/browse/MGWT-85?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel.