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

Wednesday, October 3, 2012

How to build Maven Repository


  1. Download nexus war file from http://www.sonatype.org/downloads/nexus-2.1.2.war
  2. Rename nexus-2.1.2.war to nexus.war. 
  3. Put nexus.war into your tomcat webapp folder. 
  4. Start tomcat server 
  5. Login your nexus server:  http://127.0.0.1:8080/nexus (the default user/password: admin/admin123)
  6. Use the web UI to upload your jar file, as follows: 
  • Select the "3rd party" repository
  • Choose the "Artifact Upload" tab. 
  • Follow the steps in the screen to choose your jar file to upload. 

  • Choose the "Browse Storage" tab to check your uploaded jar file
  • Double click your uploaded jar file (i.e, Test-1.jar) will show the dependency content for pom.xml

In you pom.xml, you need to add the following content to connect your maven repository: 
  • <repositories>
  • <repository>
  • <id>VPDC</id>
  • <name>VPDC Repository</name>
  • <url>http://localhost:8080/nexus/content/groups/public/</url>
  • </repository>
  • </repositories>
To get your uploaded jar file (i.e., Test.jar), you also need to add the following content in your pom.xml: 
  • <dependency>
  • <groupId>org.springframework</groupId>
  • <artifactId>spring-hibernate3</artifactId>
  • <version>2.0.8</version>
  • </dependency>

Sunday, September 9, 2012

Build Maven Web Project from Eclipse

  •  Open your eclpse, New->Others, choose "Maven Project" and pres Next.
 
  •  Check "Create a simple project (skip archetype selection)" and press Next.
  • Fill "Group Id", "Artifact Id" fields, and choose "war" in Packaging drop list. 
  • Press Finish.
  • Since Maven didn't generate the web.xml, you have to build this file in path (src/main/java/webapp) manually.





    Saturday, September 8, 2012

    Maven Installation

    For command line:
    • Set the Maven/bin in your path. 
    • Type "mvn --version" for testing, the output are showed in below: 
    •  C:\Users\Stanley_PC>mvn --version
      Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
      Java version: 1.6.0_24
      Java home: C:\Program Files\Java\jdk1.6.0_24\jre
      Default locale: zh_TW, platform encoding: MS950
      OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows

     For Eclipse Plug-in
    • Use the Eclipse Marketplace menu and input "Maven", you can get the following screen. 

    • Install the "m2eclipse-wtp: Maven Integration for Eclipse WTP" and  "Maven Integration for Eclipse", where WTP package for web project. 
    • Now, you can new a Maven project.