I am a new programmer to a maven web project, and m2e in eclipse gives an error that others tell me to ignore but I would like to fix. A clean and rebuild in eclipse marks the <execution> tag as an error, and hovering over it shows the following:
Could not process schema:
projectXsdOne.xsd (org.codehaus.mojo:jaxb2-maven-plugin:1.2:xjc:JAXBStringifiedGeneration:generate-sources)
org.apache.maven.plugin.MojoExecutionException: Could not process schema:
projectXsdOne.xsd
at org.codehaus.mojo.jaxb2.XjcMojo.execute(XjcMojo.java:313)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
There was one post about a very similar error that the poster originally fixed by adding <xmlSchema> and <wsdl> tags of false and true, respectively, to the <configuration> portion of the <execution> tag, but that didn't eliminate my error. The web application does seem to run, but I hate having an error "on the boards" and just ignoring it. Does anyone know what else I might try to fix it?
I'm running eclipse photon, m2e 1.9.0 (configured to run "embedded"), java JDK 1.8.0_51, Windows 10.
There exists multiple JAXB plugins for Maven.
Have a look at: difference-of-maven-jaxb-plugins
The different plugins varies in age and activity, and the support for them by the m2e plugin have historically not been that great.
You can try some of the other plugins, or maybe try to exchange it for another plugin like e.g. The CXF XJC Maven Plugin, and see if it makes a difference.
Otherwise you will probably have to accept the fact that Maven support in Eclipse is not complete, and ignore the error or ignore the plugin goal.
Related
I am trying to write a sample REST web services demo using Jersey.
After creating a Maven project - this is the error I have
Description Resource Path Location Type Cannot read lifecycle mapping
metadata for artifact
org.apache.maven.plugins:maven-clean-plugin:maven-plugin:2.5:runtime
Cause: error in opening zip file pom.xml /MyRestDemo line 1 Maven
Project Build Lifecycle Mapping Problem
Screen shot
Per suggestions on previous stack overflow posts,
I have deleted the .m2 repository and updated the project - error persists.
I have deleted just maven - clean plugin still have the same error.
I have the same error with both Eclipse Neon and Luna and I am stuck at this point.
Thanks
Set of Actions that could be taken according to eclipse foundation: https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
Modify you POM.xml with below plugin.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
The above should work fine, if still you are facing problem then Go to
.m2/repository , delete all files. come to eclipse and rebuild your project.
One more reason for the above error could be a bad download of artifact, please check the proxy details of your company or home in (~/.m2/settings.xml)
This is an extremely weird error message:
org.apache.maven.plugins:maven-clean-plugin:maven-plugin:2.5:runtime
Cause: error in opening zip file pom.xml
"ZIP file pom.xml"? Why would it think that? Maybe try to run Maven from the command line (or using Run -> "Maven ..." inside of Eclipse). That might give you a different / better error message.
If that doesn't help, some background: m2e (the Maven plugin for Eclipse) tries to figure out which Maven targets it should run as part of the build inside of Eclipse. mvn clean is one of them. To see what m2e thinks, select the project, right click, Properties, Maven, "Lifecycle Mapping".
The target clean:clean should be mapped to "ignore" since Eclipse already does that well.
Which makes me wonder why it wants to run in your case.
If the mapping is correct for you, then sometimes m2e get stuck in weird ways. Try to update the project (right click project, Maven, "Update Project..."). Make sure "Update project configuration from pom.xml" is enabled.
If that also doesn't work, then something broke your Eclipse installation. Try to install the latest version of Eclipse and try to open the project there.
I got a maven spring project but when I try to run it, I can't... some idea about it...
The next is the Error Message:
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.532s
Finished at: Wed Jul 26 16:04:06 COT 2017
Final Memory: 17M/196M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce
(enforce-versions) on project SIMI: Some Enforcer rules have failed. Look above for
specific messages explaining why the rule failed. -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
one thing that may cause this problem is that in your project in a POM file required java or maven version is set. you should find it... but how ?
maybe you couldn't find any enforcer in your project like me ...
(I had the same problem and I became confused because enforcer plugin was not defined in my projects POMs, so I couldn't find it).
enforcer plugin is in your "effective pom" and you should check it.
Effective pom is a configuration file made from super pom + project pom.
maven use this configuration file to execute the relevant goal. It helps developers to specify minimum configuration detail in his/her pom.xml. Although configurations can be overridden easily.
For showing your effective pom there are 2 ways:
1- use maven command, run this command :
mvn help:effective-pom
2- use your IDE : in Maven window right click on your project node and select show effective POM(it depends on your IDE).
after you find what your forces are you can find it in your project and change it.
for me, My effective POM had enforcer plugin which its requireMavenVersion rule for using Java was 1.8. so I changed my project JDK version to 1.8 and luckily the problem was solved.
I hope this answer could help you.
You should solve the root cause of the issue, conflict between some of your dependecies, mvn/java version, there is a lot of possible reasons.
You might run mvn dependency:tree and check in the list if there is maybe 2 different versions or implementations of the same library from different package. Often you will have a parent pom or a dependency somewhere in the framework uncompatible with one that you added into your pom.
But often, despite this enforcer error your project could build and run perfectly so this is a workaround to build ignoring the error
To skip enforcer (not always working)
mvn clean install -Denforcer.skip=true
To continue the build if error
mvn clean install -Denforcer.fail=false
There is probably some ways to exclude a specific library from the enforcer rules too which is probably better that juste skipping everything.
If you are using version 1.4.1 of maven-enforcer-plugin and it is resulting in this error then you need to use an older version of maven-enforcer-plugin. You can find the Maven dependency below :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
</plugin>
Other versions can be found from the link below.
https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-enforcer-plugin
Also, check your Maven version. If you are using maven 3.0.x then you need to use maven-enforcer-plugin 1.4.1.
It is possible that someone is enforcing a specific Maven version.
If you see the following message:
[WARNING] Rule 0:
org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message:
Detected Maven Version: 3.5.4 is not in the allowed range [3.5.2,3.5.2].
Then change your maven installation to the something in the specified range.
In this example, only version 3.5.2 is allowed.
This error is likely caused due to a mismatch of the java version specified in the pom file and the java in your system. I had Java 16 installed in my system but the pom pointed to java version 8.
There are 2 ways to solve this:
Update the java version in the pom file to the java version installed on your PC, but this will likely cause a lot of dependency issues.
Uninstall java installed in your system, and reinstall the java version specified in the pom file. You can do this by following the steps mentioned below:
Check the java version in your system with the following command:
java -version
And then check the java version defined in your pom file. It'd be something like
<project.java.version>1.8</project.java.version>
Install JDK 8.
I had this problem because Java (java) was version 8 and the Java compiler (javac) was version 11.
This is typical for Windows users, if you need to switch between versions manually.
Please check the versions first:
java -version
javac -version
If an IDE is used, for example an IntelliJ Idea, then I will advise to carefully study the project settings as well. Perhaps it makes sense to completely delete the files generated by the IDE and import the project again.
I faced the same issue and resolved it by fixing the pom versions. Below command didn't run properly on all the sub pom's which resulted in different pom versions.
'mvn versions:set -DnewVersion=${NEW_VERSION} versions:commit'
Check whether all the moms have same version if there is dependent pom's.
After doing some research found an answer for this .if your using IntelliJ
Go to Settings ---> builds --> Maven -->set the Maven home directory.
I faced this issue. Its because of the maven binary version used.
I have used maven 3.0.3 version. and the enforcer plugin wasn't reliable with that. So changed the maven binary to latest 3.6.3. And the issue got resolved and working awesome.
Firslty go tto project and run mvn clean , if build is success then just check whether the required dependency is downloaded in your .m2 folder or not , If dependency does not get downloaded in your local .m2 folder , it means either version number is incorrect for that dependency or artifactory path is not correct
Else if mvn clean itself fails while dependency exist in your .m2 folder , means yoru settings.xml file actually got corrupted
You should probably check if you have two different versions of same artifact somewhere. I faced it when I wanted to add new maven dependency while I already added it on a different dependent project with different versions.
Check your maven version, for example, if you are installing Apache-CXF 3.6 and your maven version is 3.0.5, then you get errors. If you're installing Apache-CXF 3.6, the minimun version of maven must be 3.1, and the minimun version of Java must be 8.
In my case, apparently there was a configuration conflict that generated this error. So when I temporarily deleted the /home/myuser/.m2/settings.xml file, the per-line maven execution was successful.
Note: In my scenario, I had Eclipse with the maven plugin and I was trying to use maven by command line and then this error message appeared.
I initially checked the java version with the following command
java -version
As it is was not on the required java version,I changed the java version by using following command
sudo update-alternatives --config java
This command gave me options to choose the required java version.
After proper selection of java I could perform the following command
mvn clean install -DskipTests
and the build was successful.Hence solved this issue
This worked for me.
mvn clean
mvn clean install
The question is howto install XBee-API in Netbeans for use with other projects?
The answer should be to simply download the maven project from github and import into Netbeans. Easy-peasy. The reality is not so simple. As a Java noobie it has taken me a day to get Xbee API to compile and run under Netbeans.
XBee-API version 0.9.1 from Github is in a Maven project that imports directly into Netbeans but it won't compile without further work. For initial tests, I used the Digi SDK kit connected via a USB/serial cable to my win10 PC. I was running a XBee S2C Digimesh device. Ultimately the reason I am using XBee_API is communicate with a Raspberry Pi 3B via I2C.
The first XBee-API class to try to run is "OpenCloseConnectionsTest" found in the Test folder. This provides very detailed debug information that should help with troubleshooting. If this will run, then everything else should as well.
First error was because the XBee-API POM file did not include a version tag. My POM now looks like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Next I was missing RxTx files. On my win10 installation I was missing the following files in the following locations:
...\Program Files\Java\jkd1.6.0_01\jre\bin\rxtxSerial.dll
...\Program Files\Java\jdk1.6.0_01\jre\lib\ext\RXTXcomm.jar
I downloaded these from here. Once I placed these files in these locations, Netbeans found them without further action/config. I still have a warning because these files aren't quite the same version.
Finally, I needed to edit the source code to set the comm port ID. In my case, the XBee was on "COM5".
I could not find any single source that has all of the above information. A lot of information I found was outdated and some was simply wrong. Hopefully this write-up will help others.
OK so I am working on an answer to my question. So in order to get the very latest version 0.9.2 of XBee-API, I need to install a project from the Maven Central Repository into Netbeans. I found a couple of posts that pointed me here.
I didn't find this useful at all. The answer might be there somewhere but it assumes a level of understanding of Maven and Ant that I don't have, so I experimented. I created a new Maven project in Netbeans and then copied the content of the XBee-API POM file I found in Maven Central and pasted that to replace the content of the default POM file in the new Maven project I had created.
My understanding is that Maven will download all the files needed based on the POM file, but it didn't. Most of the files were downloaded, but not all. I got the following warnings:
Some problems were encountered while building the effective model for com.rapplogic:xbee-api:jar:0.9.2
'build.plugins.plugin.version' for org.apache.maven.plugins:maven-gpg-plugin is missing. # line 60, column 21
'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 51, column 21
'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. # line 86, column 21
'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. # line 99, column 21
And also:
Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.2.1:revision (get-the-git-infos) on project xbee-api: The plugin pl.project13.maven:git-commit-id-plugin:2.2.1 requires Maven version [3.1.1,) -> [Help 1]
This might make sense to anyone that knows something about Maven, but that's not me. It looks like I need to upgrade Maven which is only a couple of months old since that is how long I have been using Java for.
I found that I am already running the latest Maven ver 3.5.0. The error message says I need 3.1.1 so upgrading Maven isn't possible and downgrading back to 3.1.1 seems like a bad idea. Time to change tack and look at using a later version of the plugin.
I found others who have had this problem here and here but no solutions. I found this response here that indicates the problem is that there is no version specified for each plugin in the POM. So it seems like Apache has changed the rules (requiring a version to be specified in the POM) but haven't provided a tool to update POMs. This seems to be something that could be scanned for and corrected within Maven Central. The POM I am running is only 5 months old and yet it won't build without manual intervention.
To fix the version problem, I had to search Maven Central for each plugin to get the latest/right version number and amend the POM. How bad is that!! That process cleared all but one fatal error. I have now hit an impasse described in the question here
The solution I am going to pursue is to work with the older version of XBee-API from Github. This gives me the source code and it builds without issue. I plan to modify this code to use I2C rather than RS232. There is also beta code for a socket server.
I managed to run findbugs within my maven build process, and I also have findbugs configured in eclipse. However when running in Eclipse and Maven I get different bugs, and I can't seem to find a setting, where the number of bugs matches in Eclipse and Maven.
My Maven settings is like this:
<version>2.5.2</version>
<configuration>
<failOnError>false</failOnError>
<threshold>Normal</threshold>
<effort>Default</effort>
<xmlOutput>true</xmlOutput>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
</configuration>
And in Eclipse I have:
Findbugs Version: 2.0.1
Analysis Effort: Default
Minimum Rank to report: 20
Minimum Confidence to Report: Medium
Reported categories: All
With those settings, I get more bugs in Eclipse. My main problem is, that I can't even match the different settings between maven and eclipse.
You could try using m2e-code-quality, which includes an m2eclipse 'connector' that should ensure your Eclipse FindBugs configuration matches the configuration specified in your pom.
I'm having exactly the same problem. There is a mismatch between settings available in Eclipse (using FindBugs 2.0.1) and the Maven plugin (version 2.5.2).
One setting that is missing from the Maven plugin is 'confidence'.
Using another piece of software to match the configurations doesn't address the issue because the Eclipse matching just highlights a problem. I want certain bugs reported from the Maven build completely independently of Eclipse that aren't being reported. It just happens that it is possible to have them reported in Eclipse.
I am trying to build the openNMS in eclipse helios using maven. After importing the source using "import existing maven project" i get the around 10k errors. Also i have some error in pom.xml itself, i thought fixing it could reduce the no of errors. The error in pom.xml is
maven-resources-plugin prior to 2.4 is not supported by m2e. Use maven-resources-plugin version 2.4 or later.
Iam referring to http://www.opennms.org/wiki/Eclipse_and_OpenNMS for building the openNMS
Iam using maven available at http://www.eclipse.org/m2e/download/
It would help if you told us which versions of Eclipse & m2eclipse you are using, and which version of OpenNMS you are trying to build.
If all else fails, you should be able to run the Maven build from the command line. In my experience, command line builds are always more reliable and predictable.
Also make sure that you are using the instructions that match the version of OpenNMS you are trying to build.
I have run the command mvn eclipse:eclipse from cmd line which downloaded the libraries in repository then i tried to import the same source directory into eclipse only to find 10k errors
That's not what I meant.
Get out of eclipse.
Get a command prompt.
Create a new directory somewhere the is not in your eclipse workspace.
Checkout the source code.
From the command prompt run "mvn install".
And you haven't answered the questions I asked above. If you don't want to answer, fine ... but don't expect us to be able to help you.
... and i get the error as Build Failure [INFO] There are test failures.
What has happened is that the unit tests have failed, presumably because something needs to be set up to enable testing. (Perhaps, the tests are trying to talk to a database?)
There are two solutions:
Find out what is causing the tests to fail, and fix it. The surefire reports may give you some clues, and there may be some developer documentation on the test setup.
Turn off the tests by adding -Dmaven.test.skip=true to the mvn command line; see this page.
It would also be a good idea to read the Maven documentation if you haven't done so already.
You cannot combine eclipse:eclipse with the m2eclipse support. You cannot use m2eclipse with a project that uses the old resource plugin.
If you want to use eclipse:eclipse, you must use NOT use the 'maven' import from eclipse. Use just 'import existing project'. If you want to use m2eclipse, don't use eclipse:eclipse.
I had this issue with the PDFBox source, with the parent pom for that project. I put this in the pdfbox/pom.xml (just to get it to compile in eclipse at lease, which is the only thing I wanted):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
<executions>
<!-- had a process goal here that i removed because it was not compatible -->
</executions>
</plugin>