I have a multi module maven project which is taking a little too much time. Can some one let me know if there is a way it is possible for me to see which step in maven compilation is taking how much time. Also is it possible to see which steps are getting executed in parallel relative to which step?
I am executing maven like below:-
mvn clean install -T 4
Maven Version 3.5.0
Related
I'm curious if it's possible to build and analyze the submodules of my multi-module maven project with a single command.
For the time being I have a single maven project with 3 separate services underneath it. Think of it like a small-scale monorepo.
Currently when I build them I can run a single mvn clean install from the top-most project and get a full build of everything with distinct JaCoCo analysis of all 3 services. In other maven projects where I already only have a single service I can simply run mvn clean install sonar:sonar but when I run it in my multi-module project it only executes at the top most level and analyses all 3 services as a single project in Sonar/SonarQube.
This answer seems to indicate it's impossible to do the same thing for a multi-module build with a single command but it's also a very old answer and things may have changed since then but with codehaus shutdown I don't think I can find that jira issue easily.
Also trying to implement the answer to that question using pluginManagement and enabling/disabling skip in parent/child modules doesn't seem to be working since sonar sees the parent as being skipped and then skips all children. It may work for exec but sonar seems to aggregate/iterate submodules differently.
The next obvious solution indicated by these questions, and to a degree the Sonar documentation itself since the deprecation of sonar.includeModules/sonar.excludeModules in 4.3 is to use Maven's advanced reactor options however that doesn't work for skipping the parent project. Trying to run mvn sonar:sonar -pl one,two,three, or the opposite mvn sonar:sonar -pl !. throws the error:
Maven session does not declare a top level project
Maven does seem to constrain itself to the correct list of modules but sonar itself seems incompatible with the approach and throws the error at the first module.
So now the answer seems to be that I need to run mvn sonar:sonar individually once per module in each module's directory, which is just a bit obnoxious.
We want to accelerate our build pipeline for a multi-module Java web application, which roughly consists of
compile/code analysis
unit tests
integration tests
GUI tests
At the moment each of these build steps starts from scratch, compiling and building again and again, which costs time and means that we do not deploy the actual files to production that have gone through the tests. Is it possible to get Maven to not recompile everything on subsequent steps but instead run the tests against the previously compiled classes?
We are using Maven3 to manage our dependencies and Teamcity as a build server (7 at the moment, planning to upgrade to 8 soon). I have tried to set up a build chain, doing a
mvn clean install
on the first step and then exporting all the */target/ folders to the following builds. Then ideally I would only do a
mvn test
mvn integration-test
Unfortunately I have not been able to persuade Maven to do this properly. Either it compiles the classes again or produces errors.
Has anyone successfully done this kind of setup and has any pointers for me? Is this possible with Maven and is this even the right way to do things?
I followed Storm Starter instructions and imported Twitter Storm in IntelliJ. For sake of testing I edited ExclaimationToplogy a bit and used following Maven command to build and run it:
mvn -f m2-pom.xml compile exec:java -Dstorm.topology=storm.starter.ExclamationTopology
But I am more interested to build and run within IDE rather than from command line. What actions do I need to perform?
Thanks
Follow the steps in storm-starter's: Using storm-starter with IntelliJ IDEA
Open Maven's pom.xml file and remove <scope>provided</scope> line from storm dependency. This enables IntelliJ to compile storm dependency on build.
Go to /src/jvm/storm/starter/, right click on ExclamationTopology file and Run 'ExclamationTop....main()'
From within IntelliJ, if you get Clojure related compiler errors involving LocalCluster then .... do a mvn clean install -DskipTests from the command line on the same project first. Then do a 'Rebuild Project' from within IntelliJ. Life is full of mysteries :-).
You need to also ensure that the storm-core is not in provided scope for storm-starter.
When Hudson goes to build my project, it executes Maven as follows:
Executing Maven: -B -f /path/to/root/pom.xml clean install
This works fine on most projects. (The -B is for "batch" or "non-interactive mode", BTW).
But for this one project that uses AndroMDA (which I can't recommend for future projects, it's really a pain-in-the-butt; slows down the build by 1000% with code generation for things that could be trivially done with inheritance and annotation-based config).
For some reason unbeknown to me, when Maven is given the -B flag the generated classes are no put on the classpath causing compilation errors for references to the generated classes. I've tested building manually with -B and without it and the result is that it builds fine without -B (outside of Hudson) and it doesn't build with -B (again, outside of Hudson).
Using Hudson version 1.369 and an external Maven 2.2.1 install.
Any advice greatly appreciated!!!
P.S. Hudson is AWESOME!!!!
The simplest version would be to have a free style project, and call maven yourself.
I am trying to build jahia from source for a project at school. From the instructions online, all I seem to find to run is
maven install
which fails... any help would be much appreciated.
Jahia is a Maven 2 project, the command you posted, "maven install", is the command for building with Maven 1.
To use Maven 2, you need to run the "mvn install" command. For details on installing Maven 2 check out the installation section of the Maven book.
The Jahia pom defines a repositories section, so should be able to access all the required dependencies.
If you have problems running the mvn command, please update your question with the build trace.