Profiling build on maven 3? - maven

I am reasking this question for maven 3:
Profiling Maven
I want to know how much time is spent for each mojo / phase / project.
There is http://jira.codehaus.org/browse/MNG-3547 and http://jira.codehaus.org/browse/MNG-4639 but I dont know about their state.
I applied MNG-3547 to apache-maven-2.2.1 and it works fine. I gather the profiling data that is emitted, parse and analyse it (using scala).
Now we are migrating to maven 3.
Are there newer / better approaches to profile a maven3 build, or should I port the patch?
Thanks in advance, Bastl.

Now, I don't know if this is really a direct answer based on Maven alone, but I do know that Sonatype's Maven 3 work on the Hudson plugin did include profiling information for a build. If you use the Maven 3 integration for Hudson you will be able to see how long your Maven builds spend in each goal.

Related

What is Workflow management using Maven?

I have only little experience using maven with eclipse. One of the job descriptions which I received has "Workflow management using Maven" as a required skill. What does this mean ? What do they possibly expect?
I think they want you to correct them? :D
I'm not sure what they refer to. I would guess it relates to the developer workflow of creating and delivering software with eclipse (?) and maven.
So setting up a project from scratch is often done from an maven archetype (a project template if you like). A lot of open source frameworks offer archetypes to start with.
For existing projects you would check out the code from version control and import it into eclipse. the m2eclipse plugin is required to do that (but I think its quite common to have it)
Then there is building the software. Which is done through executing maven phases (which will then execute plugins). See maven-phases for more details. Maven phases have default plugins that execute (for example compile will run the compiler plugin).
So your workflow would look like this: you modify the files. compile them, test them, package them, deploy the artifacts into the maven repository. the maven install phase will store the artifacts in you local repository, the maven deploy phase will upload them into the company's repository.
From there the the files are installed. Yet you can use maven plugins to install the software into a application server. That depends on the traditions of the company.
I would not think of workflow as some strict step by step think like BPMN. Development is usually done with huge amounts of personal practices (are tests written in advance or while implementing, and so on).
Hope that will help :)

Compare Maven and Gradle

As I am new to learn either maven or Gradle build tools. Therefore I wonder which one I select to study between maven and Gradle and which one has more requirement and demand in the industry. I want to use these build tools for Spring and Hibernate based projects. Any suggestion would be very helpful.
Thanks
Before this is closed for "not being a good question", I'll get some comments in.
You might want to learn the same thing that most other developers want to learn. Look at the third slide of the following slideware, which shows the results of Zeroturnaround's yearly developer survey. For this set of >2k developers, when asked what technologies they were interested in learning, Gradle was at the top of the list.
You can use either Maven or Gradle to build projects using Spring or Hibernate, but it's useful to point out that both the Spring and Hibernate code bases (not necessarily the applications using them) use Gradle to build their deliverables.
Maven provided the best build solution for quite a few years, but it's difficult to customize a build, and most Maven build scripts are very "noisy". Gradle solves those problems, while providing a smooth migration path from Maven or even Ant.

JSLinter for Maven 2

I am looking for an automated way to validate my JS code during Maven build process.
One of the projects I found is JSlint4Java. What I discovered the hard way, it works only with Maven 3, unfortunately.
You could try Wro4j with JSHint. It works great in my projects.
https://code.google.com/p/wro4j/
well I dont any way about maven. but Hudson build tool also have integration with JSLint. Maybe you can integrate with your build server

Does Maven 3 provide better performance than Maven 2?

I have tried simple:
mvn clean install -Dmaven.test.skip.exec=true
switching from Maven2 (2.2.1) to Maven3 (3.0.4 - 3.0.3).
But time used for build by Maven2 was lesss! For project that build by Maven2 near 16 minutes, on Mave3 - near 20 minutes.
But, also on stackoverflow I found than Maven3 has better performance. Should I create another local repository for Maven3 (I used old created by Maven2) or use additional options?
Thanks.
Maven 3 should be faster than Maven 2. Of course, there's always the possibility of a performance regression for some edge cases. I'm not sure where the problem is in your case but I'd start by seeing which phase takes longer and comparing that to the Maven 2 build, for instance:
is this a multi-module or a single-module build?
does the build contain non-standard build extensions, for instance the maven-bundle-plugin?
does the build use the latest versions of the plugins? The maven-compiler-plugin brings nice performance improvements for multi-module projects in version 2.4.0
does the build reference artifacts with version ranges? I recall there were some troubles in terms of performance with early Maven 3.0.x versions
are all plugin versions fixed in your POM? It is possible that Maven 3 brings in new plugin versions which have performance regressions
Once you narrow down the root cause you can either fix it yourself - if possible - or submit a bug report to the maven plugin or maven core.
You can try the -T option of Maven 3 which offers the possibility to execute parts of the lifecycle in parallel.
excerpt from the --help output:
-T,--threads <arg> Thread count, for instance 2.0C
where C is core multiplied
But it depends on which plugins versions you are using if they already up-to-date and correctly marked with #threadsafe. But sometimes it's worth a try.

what is the use of Maven in seleniumRC or WebDriver?

Can anyone explain me, for what purpose we will use Maven with seleniumRC or WebDriver? Is it like ANT - build.xml?
Your help will kindly appreciated!!
Thanks,
mra
Maven's original purpose was to handle transitive dependency management, so a developer needed only specify their "top-level" dependencies (e.g., I need Spring version n.n and webdriver version x.y).
Those dependencies have their own dependencies. Resolving those manually for all but trivial projects is difficult and error-prone. Using Maven we can make things difficult and error-prone automatically.
Kidding aside, Maven provides a lot of functionality out-of-the-box that would make for a very large Ant build.xml. Maven does handle the build process, but it also downloads your dependencies, resolves transitive dependencies, runs your tests, generates reports and a project website, and a million other things through its plugins.
Check out the docs on the Maven web site, particularly the Maven in 5 Minutes page to get started.

Resources