Showing posts with label Maven. Show all posts
Showing posts with label Maven. Show all posts

Wednesday, April 2, 2014

Change maven local repo in one command - Ubuntu/Linux


This will be useful for the developers who works with multiple maven local repositories.

Requirement:  set M2_HOME environment variable, before you start. 

Configuration
Add following  bash function to .bashrc in your home directory. Change M2_LOCATION if you need.



Then reload the .bashrc using command,
$ source ~/.bashrc


How to use: 

Type changeM2 in the terminal and give the name of the m2 repo (folder) you wish to change.

Sunday, August 25, 2013

Maven jax-ws plugin usage

This post shows an example of jax-ws maven plug-in usage. This maven plug-in can be found in two repositories
  1. org.codehaus.mojo
  2. org.jvnet.jax-ws-commons
First repository contains old versions of this plug-in. ( available upto versions 1.12 ). Second one has the Latest version (2.3) and it can be found in http://jax-ws-commons.java.net/jaxws-maven-plugin/. To use latest version, replace groupID and version fields with following .


 <groupid>org.jvnet.jax-ws-commons</groupid>
 <artifactid>jaxws-maven-plugin</artifactid>
 <version>2.3</version>


Thursday, April 25, 2013

Tips - Remote Debug with Maven 3 - Plug-in Debug

How to Debug a Maven Plug-in at Build time.

1) Open maven plug-in source code using your favorite IDE ( Eclipse, InterlliJ IDEA etc) and set break points in codes that you are going to debug.

2) Start build project using following command.

$ mvnDebug clean install 
 
3) maven starts to Listen on port 8000 till a remote debugger connects.

$ mvnDebug clean install
Preparing to Execute Maven in Debug Mode
Listening for transport dt_socket at address: 8000

 
4) Start remote debug on port 8000 using your IDE. It will trigger the build process with remote debug.

Tips - Remote Debug with Maven 3 - Test-cases

How To Debug Test-cases with Maven at maven run time

1) Open your Project with your favorite IDE ( eclipse, intellij IDEA etc) and set break points that you are going to debug.

2) Build the project using following parameters

$mvn clean install -Dmaven.surefire.debug

3) It starts to build your project and it will stop at test cases.

[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ org.wso2.bps.integration.tests ---
[INFO] Compiling 41 source files to /data/source/branch/carbon410/platform/products/bps/3.0.2/modules/integration/org.wso2.bps.integration.tests/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12:test (default-test) @ org.wso2.bps.integration.tests ---
[INFO] Surefire report directory: /data/source/branch/carbon410/platform/products/bps/3.0.2/modules/integration/org.wso2.bps.integration.tests/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Listening for transport dt_socket at address: 5005



4) Start remote debug on port 5005 using your IDE. It will trigger the build process with remote debug.


Source : http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html