Mavan Step By Step & Java Portable set up

                                                  **********Portable Java Set up**********

Just paste below content in some bat file.Open any command prompt & call this JavaSetup.bat & then you will good to go for calling java -version.

rem Set the JAVA_HOME environment variable and insert it into the system path.
rem This will make the javac and java commands reachable from the command line.
set JAVA_HOME="E:\Java"

                                                     *************Maven Setup****************

Download maven binary & set JAVA & MAVEN_HOME

set JAVA_HOME="E:\Java"
Set MAVEN_HOME="E:\apache-maven-3.3.9"

After setting above in batch file (if temporary required) or in system/user variables check mvn -v for verification & it should display java & maven details.

Then Run mvn: generate command like 

mvn archetype:generate -DgroupId=com.amit -DartifactId=SampleJava

It will download all template's & will ask to choose a number based on required project type.

which template type you need you can check by below trick.

 mvn archetype:generate > templates.txt

//waite for a minute, then exits
Press CTRL + C

just run & save it some file.After that check file where you redirected template types & choose required template. It will ask for version you may give maximum.

I provide 650: from template.txt which says 
ml.rugal.archetype:springmvc-spring-hibernate (A pretty useful JavaEE application archetype based on springmvc spring and hibernate)

then will ask couple of things like version etc just keep press enter & it will take all default. 

** if you get some error like plugin not found you can check if there is internet issue or proxy issue. If you are behind your office firewall you can set up proxy details in settings.xml file.


OK so when you will select input project will be generated.

Okay we have done it but one last important thing.If you want this project to work with in eclipse ide use below command & you will all set. Project will be converted for eclipse.

mvn eclipse:eclipse

Simple import into eclipse as open project from file system & we are good to go. Set up Done.

## To install external jar if some issue occurred in downloading jar via maven pom.xml

mvn install:install-file -DgroupId=hibernate -DartifactId=hibernate3 -Dversion=3.2.3.GA 
-Dpackaging=jar -Dfile=C:\Users\training63\.m2\repository\hibernate\hibernate3\3.2.3.GA\ -e


Popular posts from this blog

Conversion from Clob To String in java and Vice versa

Portable Java 8/ JDK8 setup without admin rights

Multi Threading , Producer consumer problem in Java