go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Running Maven
 
Subject: Running Maven
Author: Alex_Raj
In response to: Create a web application project
Posted on: 10/09/2019 06:46:12 PM


mvn phase[ phase]


Maven Phase
  • validate: validate the project is correct and all necessary information is available
  • clean: cleans up artifacts created by prior builds
  • compile: compile the source code of the project
  • test: test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package: take the compiled code and package it in its distributable format declared in <packaging>...</packaging>, such as a JAR or WAR.
  • install: install the package into the local repository, for use as a dependency in other projects locally
  • integration-test: process and deploy the package if necessary into an environment where integration tests can be run
  • verify: run any checks to verify the package is valid and meets quality criteria
  • deploy: done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

     

    > On 03/29/2012 12:37:33 AM Alex_Raj wrote:

    mvn archetype:generate -DgroupId=com.mycompany -DartifactId=MyWebProject
     -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
    


    Output:
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Stub Project (No POM) 1
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>
    >
    [INFO]
    [INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<
    <
    [INFO]
    [INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom --
    -
    [INFO] Generating project in Batch mode
    [INFO] -------------------------------------------------------------------------
    ---
    [INFO] Using following parameters for creating project from Old (1.x) Archetype:
     maven-archetype-webapp:1.0
    [INFO] -------------------------------------------------------------------------
    ---
    [INFO] Parameter: groupId, Value: com.mycompany
    [INFO] Parameter: packageName, Value: com.mycompany
    [INFO] Parameter: package, Value: com.mycompany
    [INFO] Parameter: artifactId, Value: MyWebProject
    [INFO] Parameter: basedir, Value: C:\HelloWorld\Maven\MyFirstWebProject
    [INFO] Parameter: version, Value: 1.0-SNAPSHOT
    [INFO] project created from Old (1.x) Archetype in dir: C:\HelloWorld\Maven\MyFi
    rstWebProject\MyWebProject
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 5.892s
    [INFO] Finished at: Wed Mar 28 22:18:14 PDT 2012
    [INFO] Final Memory: 9M/122M
    [INFO] ------------------------------------------------------------------------
    




    The generated Maven WebApp project is of the following structure:
     [+] -- MyWebProject
         [-] -- pom.xml
         [+] -- src
             [+] -- main
                 [+] -- resources
                 [+] -- webapp
                     [-] -- index.jsp
                     [+] -- WEB-INF
                         [-] -- web.xml
    


    The pom.xml
    <project xmlns="http://maven.apache.org/POM/4.0.0" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
      http://maven.apache.org/maven-v4_0_0.xsd">
    
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.mycompany</groupId>
      <artifactId>MyWebProject</artifactId>
    
      <packaging>war</packaging>
    
      <version>1.0-SNAPSHOT</version>
    
      <name>MyWebProject Maven Webapp</name>
      <url>http://maven.apache.org</url>
    
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    
      <build>
        <finalName>MyWebProject</finalName>
      </build>
    
    </project>
    
    


    The building tool
    mvn package
    

    is going to wrap everything into war file.




    References:

  •  


     
    Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
     
    Get your own forum today. It's easy and free.