I am working on multimodule project, and my project include 7 modules . I am using clover to create aggregate report but first thing is that clover.db is creating for every module. And second thing is that it works fine when i use command like:
mvn clean install
but when i write command like :
mvn clover2:instrument clover 2:aggregate clover2:clover
its failing.After building 5 modules its fails and say that some dependency is not found. while when i build it works fine.
I am posting you the pom.xml file on which i am calling these commands
Actually aggregate doesn't work properly in multi module projects and it's still an open issue for clover team. If I create the reports without using aggregate goal it works fine and also a consolidated report.
so
mvn clover2:instrument clover2:aggregate clover2:clover
works fine.
I had a similar problem with PMD plugin. Try deleting (or renaming) your ~/.m2/repository directory and re-running the build. Alternatively, delete from your local repository just the jar that contains the class or dependency that is "not found."
Related
I have a project with a deep maven structure and am evaluating switching from Eclipse to IntelliJ.
I've imported the top-level pom.xml. I know that I can:
Build the whole project with maven goals (I use 'test-compile' to build the test classes)
Run the tests from the IntelliJ test runner. This seems to find the classes/test-classes from the target folder of the project.
However, I would like to just change a test or the code under test, save it, and rerun it without having to manually run the maven test-compile again (like I could with Eclipse). Is this possible with IntelliJ?
I think the issue is that the IntelliJ 'Build Project' action does not build the test classes (and other classes) into the target folder that the test runner looks in.
If you import a Maven project in IntelliJ IDEA, you will be able to build and run the tests from the IDE instead of Maven which is a lot faster because of the incremental compilation.
Make sure this option is disabled and use JUnit Run/Debug configuration, don't run the maven goals.
Thanks to the suggestion from #CrazyCoder, I was able to get this working by following these steps, as I think the issue was Eclipse artifacts fighting with IntelliJ artifacts:
Remove all .classpath, .project and .iml files from the entire code tree
Remove .idea from the root - we need to start again
Open the top-level pom.xml in IntelliJ
If needed, perform a mvn compile (needed for me due to some generated sources)
Rebuild your project
After this, don't open your project in Eclipse again!
I've a parent pom project with various submodules. I want to get a report of the unit tests results but using surfire plugin, I get an independent result for each module.
I mean, if I execute:
mvn surefire-report:report
from the parent directory where the parent pom is located, it creates a surefire-report.html for each subproject but what I want, is only one html with the results of all the subprojectes.
Is there any way to achieve this automatically? Using surefire or some other plugin.
To create the aggregate report please try to use the following command at theparent project.
mvn surefire-report:report -Daggregate=true
I hope this may help.
Is it possible to combine the capabilities of an archetype and a normal Maven plugin into a single plugin?
I have a custom language which I can compile into Java source code. I've written a Maven plugin which does this in the generate-sources phase, adds the Java source to the project, and builds the project. It works as I'd expect.
However, to use it, I need to first write out a pom.xml file referencing my plugin and describing where the input files live. I'd like to be able to go straight from raw input files to compiled code in a single maven command.
For example, suppose I have this directory structure:
my-project/
some-input-file.dsl
I want to run
bash$ mvn com.waisbrot.plugin:generate -DgroupID=com.waisbrot package
and after Maven's done running have:
my-project/
some-input-file.dsl
pom.xml
target/
generated-sources/
plugin/
SomeInputFile.java
classes/
com/
waisbrot/
SomeInputFile.class
some-input-file-1.0.jar
Actually, the integration testing of the archetype allows you to declare the parameter and goals. So do this:
Pick the template project you want to create
mvn archetype:create-from-project. It will create a new archetype
Review src/test/resources/projects, especially goal.txt and archetype.properties (source: http://maven.apache.org/archetype/maven-archetype-plugin/integration-test-mojo.html). Tweak so install will be implicity
mvn verify will be able to build the archetype, run the it, and get it installed
Hope it helps
I use Jenkins to build my project which has multiple modules. This project has a root pom.xml which build all the modules under that project. I specify this pom.xml as the root POM.
Now I want to run tests as a "post-build step". But, I don't want to run all the tests under all modules. I want to run tests only under a specific module.
I tried using the shell command to change the directory to the module for which tests has to be run and then trigger maven. I also tried using the -f switch to specify the pom.xml for that particular module. Both of these steps are not working.
Please help me guys in resolving this problem.
Thanks
Just run from the root path:
mvn -pl :submodule test
protip: mvn --help
I have a strange issue and I don't know if my conclusion is correct. I have a multi module project with two children:
Rector build order:
mvn-project-test
mvn-project-core
core depends on test (so the build order is correct). Of course, running 'mvn test' doesn't install any artifacts locally. When running it, maven complaints (correctly) that ~/.m2/respositories/...../mvn-project-test-1.0-SNAPSHOT.jar is missing and the core build fails.
Shouldn't maven use the dependencies from the target folder of other multimodule children? Or must I always use 'mvn test install' on multi module projects? (Or third, I'm completely wrong and my whole project configurationis somehow broken)
Finally, the test project hasn't any content, yet, just dependencies so the jar is empty. But that shouldn't be a problem, right?
Cheers,
Jan
There were ideas for Maven 3 to allow the various mojos to see the whole build and do magic like "if none of my upstream projects changed, skip my tests" and things like that.
But as it is, each module is independent. Dependencies will only be resolved from the local repository. So if you don't mvn install, your tests won't work.