maven plugin execution issue - maven

I am using aspectj in a project. when i add the aspectj-maven-plugin to the build, the aspects are woven in and things work as expected. however, i get an error in the POM saying that the plugin execution is not covered by lifecycle configuration.
from what i've read in other problems, it says the solution is to simply wrap the plugin in a pluginManagement tag. that does seem to get rid of the error, however, when i do a mvn clean install, the aspectj plugin no longer runs. any idea on how to solve that problem?

Related

A required class was missing while executing org.apache.axis2:axis-wsdl2code-maven-plugin:1.3

I am trying to upgrade my project running in 1.5 to 1.8(jdk), and I am using Maven 3.0.4 in conjunction. While trying to execute command "mvn build" I get the error "The required class was missing while executing org.apache.axis2:axis2-wsdl2code-maven-plugin:1.3:wsdl2code: org/apache/neethi/policy".
I have tried installing fresh jars and pom files, added them to the build path, also added it to POM dependencies. I even added axis2-codegen jar as suggested in some answer in this site. I've even tried "mvn -U clean install", also as suggested in one the answers. But so far nothing seems to work. I am fairly new to Maven, so any help will be appreciated.
P.S.: I cannot post any actual code or snapshots of the errors as it is a corporate project. I have tried to put up as much data as possible without breaching my NDA.
Thanks.
Since you did not get a compile error, I am assuming there should be conflicting transient dependencies.
Try executing,
mvn dependency:tree -Dincludes=org.apache.axis2
If you have multiple versions of the same dependency, have the unintended versions excluded in your pom file.
Note: You can do this operation in your IDE too. "IntelliJ Idea", has a really nice interface for this operation.

How to debug loading of wrong Maven plugin

In build section of my effective pom there is a Maven plugin that I don't want to use (it was used before, but now I want to remove it).
I removed this plugin from every parent of my project, but is is still applied.
How do I find out where this plugin declaration come from?
UPDATE:
It turns out this plugin was an implicit dependency of another one. It was not declared as such, but referenced from plugin's components.XML leading to runtime dependency injection. The problem was found by pure luck. I think the question is still relevant - it should be possible to find implicit plugin dependencies without wasting a day or two.
Have you run
mvn install
on the parent pom when you deleted the plugin from there?
When you run mvn from submodule it actually looks into your local repository for parent/siblings modules (jars, poms), not to filesystem (compared to maven using the result of the build when you run whole parent project build with submodules).
If it doesn't help, have a look if it's not coming from super pom. You can see super pom on maven website:
http://maven.apache.org/ref/3.0.5/maven-model-builder/super-pom.html

Cargo run / start not working, missing Ant dependency?

I've been trying to set up the cargo-maven2 plugin (although I am using Maven 3; and this is supposed to be ok) so that I can start a container during the pre-integration-test phase and shut it down in the post-integration test phase.
I'm having no luck. I keep getting this error message:
Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.2.4:start (start-container) on project microgivr.web: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.2.4:start failed: Unable to load the mojo 'start' in the plugin 'org.codehaus.cargo:cargo-maven2-plugin:1.2.4'. A required class is missing: org/apache/tools/ant/BuildException
Easy fix, right? Add Ant as a dependency. So I add:
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.4</version>
</dependency>
(And lord only know why this should need Ant in the first place.)
I can now find org.apache.tools.ant.BuildException on my classpath, but I STILL get this error.
So, thinking this is surely some issue with my own build, I decided to start fresh, using the maven2-cargo-plugin archetype documented here: http://cargo.codehaus.org/Maven2+Archetypes
You know what? Same problem!
I've tried different versions of the plugin. I've tried different versions of Ant. No luck.
Someone MUST have run into this before. I see mentions of this issue online, but don't see any solutions.
Any insight is appreciated!
Damnit. I guess I put the Ant dependency in the wrong spot. That dependency needs to be expressed in the plugin's OWN stanza; NOT with the rest of the dependencies.
So... moving it did the trick.

"m2e plugin execution not covered..." with parent project configuration

I have dealt with jslint-maven-plugin getting caught by the infamous "plugin execution not covered by lifecycle configuration" error by adding an ignore action to the pom, as per Eclipsepedia advice.
Works great, if I have the pluginManagement section in the project's pom, or in a parent project pom in my local workspace.
However, it breaks again as if I hadn't applied the fix if the parent is not in my local workspace, despite the effective pom still showing the additional config. The build works fine from the command line, it just seems to be the IDE UI that's not working correctly.
Any ideas why this might be happening and how I could resolve the problem?
Maven 3.0.3 and m2e 1.0.200.

CheckStyle from maven: how to fail at the very end?

I have a multi-module maven build configured to run CheckStyle. It works, but it fails as soon as it comes across a module with a violation. How can I process all modules but not fail until the very end? I'd like to be able to see all violations without having to fix/re-run repeatedly.
I'd advise to do this in your IDE, to get checkstyle violations feedback while you code, and not only late when building using Maven. Still keep maven checking for violations, and fail a build as early as possible, on first module with violations.
E.g. there is eclipse-cs, checkstyle plugin for eclipse IDE. To have both maven-checkstyle-plugin and eclipce-cs use same checkstyle configuration file, install m2e eclipse plugin and it's extensions including one for eclipse-cs.

Resources