Page Count

Saturday, August 12, 2017

Maven Build Life Cyles

Following are the maven build life cycles.

Clean - Removes the generated files in 'target' folder.

command : mvn clean

Validate - It validates your project and verify all the necessary information is there in project or not.

mvn  valiate

Compile - It compiles your project code.

mvn compile

Package - It takes the compiled code and packaged to JAR/WAR/EAR. It also compiles your code if your code is not compiled.

mvn package

Install -   It takes the packaged code and puts in your local maven repository (M2_HOME). It also does the compile and package if these are not already been done.

mvn install

Deploy - It takes the package and puts in remote repository for sharing accross team members or for other projects.

mvn deploy


FYI - Above commands can be used as variety of combinations.
e.g. mvn clean install
mvn clean package
mvn clean compile package install

To skip the tests to run 
mvn clean install -DskipTests



Sunday, November 27, 2016

Regular Expression in java


1 [abc] a, b, or c (simple class)
2 [^abc] Any character except a, b, or c (negation)
3 [a-zA-Z] a through z or A through Z, inclusive (range)
4 [a-d[m-p]] a through d, or m through p: [a-dm-p] (union)
5 [a-z&&[def]] d, e, or f (intersection)
6 [a-z&&[^bc]] a through z, except for b and c: [ad-z] (subtraction)
7 [a-z&&[^m-p]] a through z, and not m through p: [a-lq-z](subtraction)

X?  X, once or not at all
X*  X, zero or more times
X+  X, one or more times
X{n}    X, exactly n times
X{n,}   X, at least n times
X{n,m}  X, at least n but not more than m times

Reluctant quantifiers
X?? X, once or not at all
X*? X, zero or more times
X+? X, one or more times
X{n}?   X, exactly n times
X{n,}?  X, at least n times
X{n,m}? X, at least n but not more than m times

Possessive quantifiers
X?+ X, once or not at all
X*+ X, zero or more times
X++ X, one or more times
X{n}+   X, exactly n times
X{n,}+  X, at least n times
X{n,m}+ X, at least n but not more than m times


To Split the String with spaces

String[] words = line.split("\\s+");