A maven project is a special directory structure which is accepted by all industry to develop web application and enterprise application.It is used to provide clean separation between all the classes,XML file and the jar file in a well formed manner.
A typical maven project contains some standard directory structure for every java based web project and enterprise project. Its structure is like......
List OF Maven Command
. Compile
A typical maven project contains some standard directory structure for every java based web project and enterprise project. Its structure is like......
Folder Directory Explanation.
List OF Maven Command
. Compile
- mvn compile
. Compile (offline)it will save you a lot of time because it will not download any thing from internet.- mvn -o compile
3. Install the generated output to the respective repository
4. Clean Target Directory- mvn install
5. Package as jar or war- mvn clean
6. Generate Eclipse project descriptors- mvn package
7. Run unit tests- mvn eclipse:eclipse
8. Run unit tests and print the output to console rather than to file- mvn test
9. Run individual test- mvn -Dsurefire.useFile=false test
10. Package without running tests- mvn test –Dtest=org.shankh.mavenTest
11. Install without Running Tests- mvn package -Dmaven.test.skip
12. To download source code into your maven repo:- mvn install -Dmaven.test.skip
13. Create a new project- mvn eclipse:clean eclipse:eclipse –DdownloadSources=true
Comment : Instead of ‘generate’ i wrote ‘create’ initially, but as simonz correctly pointed out, mvn archetype:create is now deprecated. so use mvn archetype:generate instead.- mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app
14. Create a Web Application
15. Start embedded Jetty- mvn archetype:generate
- -DarchetypeGroupId=org.apache.maven.archetypes
- -DarchetypeArtifactId=maven-archetype-webapp
- -DgroupId=com.mycompany
- -DartifactId=my-app
16. Deploys a WAR to embedded instance of Jetty and starts it- mvn jetty:run
17. Specify Java Build version- mvn jetty:run-war
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </build>18. Generate site for a single project
19. Generate Javadoc- mvn site
20. Set Maven_opts System environment variable (will save you from out of memory error)- mvn javadoc:javadoc
21. Setting M2 variable in eclipse (informing of repository location- MAVEN_OPTS=”-Xmx512m -Xms256m -XX:MaxPermSize=128m”
Goto Window -> Preferences -> Java -> build path -> classpath variable -> New Name: M2_REPO Path: C:\Users\my_user_name\.m2\repository (In vista) C:\Documents And Settings\my_user_name\.m2\repository (In XP) ~/.m2/repository (in Linus/ unix flavours)


Thank u so much...It s very Helpful..
ReplyDeleteThanks for response..............
Deletethis explanation is giving clear cut idea about maven.this is very understandable and excellent explanation.thnks a lot..........
ReplyDeleteone request plz give lk ths axplanation about log4j....
Good Work....Keep it up and Thanx alot....
ReplyDelete