I have the same problem like on the below link , and solution from there works
but i have a little of hard time in understanding what it cause this and how it affects the project.
Plugin execution not covered by lifecycle configuration (JBossas 7 EAR archetype)
I start reading about m2e
http://wiki.eclipse.org/M2E_plugin_execution_not_covered
What is the difference between the 'eclipse build' and maven one ?
Still not clear what is meant by "interesting" and "not-interesting" mojo executions:
https://docs.sonatype.org/display/M2ECLIPSE/Project+build+lifecycle+mapping
So there is the solution but , not the understanding of the problem.
Thanks for helping me understand the problem ...:)
Generally speaking, The way m2e used for resolving/mapping plugins' goal execution into Eclipse build life cycle has been reinvented after version 0.12. Now m2e requires explicit instructions what to do with all Maven plugins bound to "interesting" phases of a project build lifecycle. By either configure the lifecycle mapping in your project's pom, or use specific m2e configurator Eclipse plugin if somebody has kindly created it for the community.
By "interesting" they mean phases which normally occur during writing and debuging of code inside the IDE, mostly excluding packaging and deployment steps.
Also note (from this blog post):
M2E allows you to run Maven manually. You can invoke a goal like "mvn install" from within Eclipse just as you would do it from the command line. That works (and always worked) just fine. Unfortunately, Maven is also invoked automagically from M2E whenever Eclipse builds the project, for example after a clean. In such cases M2E acts as an "Eclipse Builder". It is these latter invocations that people have always had problems with and that the connectors should handle better.
Related
I was going through the maven documentation. I saw maven works using plugins, for each phase there is one or more plugin and for each plugin there is one or more goals. there are plugin for compile, install, deploy, clean etc. I saw in my project they used maven-clean-plugin. Then how maven clean install command is working if we did not put the maven-install-plugin? Question might be bit silly but i am new the this world and appreciate your help.
That would follow up with some default configuration of each plugin inherited with Maven's BOM. Executing
mvn dependency:resolve-plugins
shall help you identify these versions of the plugins inherited.
So primarily to ensure you work with a specific(or updated) version of the plugin with the desired configuration of your project, you can explicitly define them in the pom.xml, otherwise, just let be.
The Maven lifecycle has standard bindings for plugins to the different phases.
If you run mvn clean install you run the plugins that a attached to the phases by default.
The solution which needs bootstrapping is supplied as java code. Absolutely sure that this is necessary.
Receivers of the solution are guaranteed to have a suitable JDK
However, receivers of the solution are unable to install Maven (they don't know how to and cannot be taught)
My idea is to include some sort of Maven with the project, such that can be set up in a script like so:
set up maven repo as a folder under the solution folder (using relative reference)
set up anything else maven needs (don't know what, exactly)
call /path/to/maven/mvn compile -f /path/to/oneAndOnly/pom.xml
java /target/MySolutionClas
I am aware of: https://dzone.com/articles/embedding-maven but it gets confusing when he talks about configuring the portable maven into the pom.xml - wait, how is that pom.xml going to mean anything if maven is not configured yet?
(PS: I mean no disrespect to the author. I probably got it all wrong)
One could include a shell script that would setup maven if it is not already present.
The same for building and packaging encapsulating the complexities of the setup to just runing a couple of scripts.
Maven Wrapper aims to do just that, similar to the gradle wrapper seen in many gradle projects.
Running the wrapper goal of the maven wrapper plugin will generate a mvnw script in your project that can be run in place of a globally installed mvn command.
It's part of the maven 3.7.0 release, and documented more fully here: https://maven.apache.org/plugins/maven-wrapper-plugin/index.html
See https://github.com/takari/maven-wrapper for maven < 3.7.0
I wonder if when I hit Project > Clean, mvn is really involved in setting up the build process.
Is M2E (Maven to Eclipse, standard plug-in) just reading and analyzing the pom setting up / updating the Eclipse project the way specified by the pom or does it actually run the phases defined in the pom?
I just wonder what happens on Project > Clean when it comes to Maven... .
[Update]
Since people seam to get confused by the question here are more information:
I altered the build process of the project in maven and it seam to be not reflected by actions I trigger in the IDE directly. So M2E seams to be more like a translator of maven settings and applying the same settings to Eclipse without altering the behaviour. It also would explain why M2E is providing connectors in the first place.
Since I could not verify this, I boiled it down to a simple question that if answered, I know the answer to the more difficult question regarding Maven integration in Eclipse.
[Update2]
M2E has the ability to execute certain phases. I added an answer. This answer is not obvious since I searched the internet up and down before I asked this question. Also I only found the answer by some thoughts that were raised by the previous answer to this question which is what I asked for but only half of the picture.
This question is a perfect example why often on stack overflow the obvious is neither asked nor was implied nor is the final answer and the trigger happy close friendly swarm sometimes misses the point :-).
When you clean a eclipse project, eclipse clears output directories of the project, without invoking maven. This is a eclipse operation that is executed over all projects you have, whether or not the projects has been imported from maven.
If you want to run maven targets on an imported eclipse project, you could use Run configurations to explicitly invoke maven targets on the projects.
M2E does has its own mapping for each phase. Depending on this mapping Eclipse actions are replaced, extended or left-as-is.
From the following picture one can see that the clean command is set to ignore. You can view/change those mappings by Project Properties > Maven > Lifecycle Mapping. So this is actually (as-expected) a per phase mapping. By downloading new connectors M2E is able to provide additional mappings to special phases not supported by default installation.
I have crated maven project in eclipse to compile xstream library for java 1.4. Currently I have several errors shown below.
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.5:maven-version (execution: versions, phase: initialize)
What is that?
maven-resources-plugin prior to 2.4 is not supported by m2e. Use
maven-resources-plugin version 2.4 or later.
Where to get this plugin?
And several other errors similar to firs one:
Plugin execution not covered by lifecycle configuration:
org.codehaus.mojo:build-helper-maven-plugin:1.5:parse-version
(execution: versions, phase: initialize)
Plugin execution not covered by lifecycle configuration:
org.apache.felix:maven-bundle-plugin:2.3.7:manifest (execution:
bundle-manifest, phase: process-classes)
How to solve these problems?
This is caused because Maven and Eclipse are two different building tools, sometimes resembling and sometimes disjoint. So, the M2 plugin is supposed to adapt the POM's contents to the building lifecycle of Eclipse. However, as Maven's building lifecycle is much more complete than Eclipse's, M2 is not always able to do such an adaptation, and in these cases it raises the error you are asking about.
Usually, you should not worry a lot about this, because the project will eventually be built by Maven, so the important thing is the POM be 100% understood by Maven, not Eclipse. We use Eclipse mostly for the automatic building, not for producing the final JAR.
Anyway, you can drop these errors through three alternative options (available in the very screenshots you have posted):
Discover new M2 connectors: I do not recommend this, if you are using the latest M2 version. You can give it a try once, if you want.
The other two options are both aimed to instruct Eclipse to ignore the reported plugins:
Permanently mark goal X in pom.xml as ignored: It adds an extra declaration to the POM marking that plugin as ignorable by Eclipse.
Mark goal X as ignored in Eclipse build: It leaves the POM unmodified, but adds that info to the current Eclipse workspace metadata, so it will be applied to all POMs (present and future) in the same workspace.
I come from a Ruby on Rails background and I am learning Java Spring MVC right now. When I try to compile my code using Maven in STS it wants me to include a goal. All the guides I read on this seem vague and unclear. What is the point of a goal? Why can't I just compile my source code and run it?
You have to understand that Maven is complex and modular.
It does not have any concept of "compiling" your code or "running" your code. What it does is trigger plugins in the order of the build lifecycle.
Running a Maven goal triggers a particular Maven plugin. For example, running mvn compile triggers the Maven compiler plugin.
This all seems to be overkill for someone just starting in Java, and there are many "why can't Maven just do what its told" questions on SO.
Most of these stem from a fundamental misunderstanding of what Maven is. It is not (strictly speaking) designed to "compile and run" your code. It is designed to carry out a number of preconfigured steps in a particular order.
When it comes to "running your code", this gets even trickier:
to run your code with the maven exec plugin, call mvn exec:java. You obviously need to configure the plugin
to run your code as a webapp with an embedded Tomcat server, call mvn tomcat7:run-war.
to run your code as GWT application in devMode on an embedded webserver call mvn gwt:run
What all these goals have in common is that they trigger a specific, pre-configured, plugin that carries out the task you have asked for.
It is further worth pointing out that Maven is designed to compile, test and install your code, not really to run it. So whilst may plugins for running code do exist, the real strength of Maven comes from being able to automate the compiling, testing and deployment of code to a Maven repository.
As a final note, the massive red warning at the top of the page you linked says:
Apache Maven 1.x has reached its end of life, and is no longer
supported.
Take heed. We're now on Maven 3.2.X. Don't read documentation for ancient and obsolete versions. This will serve no purpose but to confuse you.