maven

Page 1

What is Maven: •

Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

Maven is a high-level, intelligent project management, build and deployment tool provided by Apache's software foundation group.

Apache Maven is a command line tool with some IDE integrations.

Maven is dependency management tool

Maven is a software tool for project management and build automation. While primarily used for Java programming, it can also be used to build and manage projects written in C#, Ruby, Scala, and other languages.

Objectives of Maven: Maven's primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with: • • • • •

Making the build process easy Providing a uniform building system Providing quality project information Provides guidelines related for best practices development Allowing transparent migration to new features

Maven Architecture:


the

Here POM Is Maven's understanding of particular project. The pom.xml files form a tree, and each can inherit attributes from its parent. Maven provides a Super POM. The Super POM sits at the top the hierarchy tree and contains default common attributes for all projects; every project POM inherits from it.

Dependencies are specified as part of the pom.xml file. Maven resolves project dependencies according to its dependency management model. Maven looks for dependent components (called artifacts in Maven terminology) in local and global repositories. Artifacts resolved in remote repositories are downloaded to the local repository for efficiency of subsequent access. The dependency resolver in Maven 2 can deal with transitive dependencies. That is,it works properly when resolving dependencies that your dependencies depend on.

The Maven engine itself performs almost all its file-handling tasks through plug-ins. Plug-ins are configured and described in the pom.xml file. The plug-ins themselves are handled as artifacts by the dependency management system and are downloaded on demand as they are needed for a build task. Each plug-in can be associated with various phases of a life cycle. The Maven engine has a state machine that marches through the life-cycle phases and invokes plug-ins as necessary.

How Maven Works:


Maven Core Concepts •

POM : Project Object Model • • • •

POM stands for "Project Object Model". It is an XML representation of a Maven project held in a file named pom.xml. Maven projects,dependencies,builds,artifacts: all of these are objects to be modeled and described. These objects are described by an XML file called a Project Object Model (POM). A Maven project is defined by the presence of a pom.xml. Pom.xml contains metadata about the project. ▪ Project coordinates • groupId - Arbitrary project grouping identifier (no spaces or colons) • artifactId - Arbitrary name of project (no spaces or colons) • version – version of project ◦ Format {Major}.{Minor}.{Maintenance} ◦ Add =-SNAPSHOT' to identify in development • packaging Type (jar,war,ear,pom,custom,--) - Tells Maven how to build the project ▪ Project info(developers,website,scm url) ▪ Dependencies ▪ plugins

Basic pom.xml: <?xml version="1.0" encoding="UTF-8"?> <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> <!-- The Basics --> <groupId>...</groupId> <artifactId>...</artifactId> <version>...</version> <packaging>...</packaging> <dependencies>...</dependencies> <parent>...</parent> <dependencyManagement>...</dependencyManagement> <modules>...</modules> <properties>...</properties> <!-- Build Settings --> <build>...</build>


<reporting>...</reporting> <!-- More Project Information --> <name>...</name> <description>...</description> <url>...</url> <inceptionYear>...</inceptionYear> <licenses>...</licenses> <organization>...</organization> <developers>...</developers> <contributors>...</contributors> <!-- Environment Settings --> <issueManagement>...</issueManagement> <ciManagement>...</ciManagement> <mailingLists>...</mailingLists> <scm>...</scm> <prerequisites>...</prerequisites> <repositories>...</repositories> <pluginRepositories>...</pluginRepositories> <distributionManagement>...</distributionManagement> <profiles>...</profiles> </project> Simple pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project> <modelVersion>4.0.0</modelVersion> <groupId>com.clickandbuy</groupId> <artifactId>comarch.ws</artifactId> <packaging>war</packaging> <version>fb-8.4-SNAPSHOT</version> <name>comarch,/name> <dependencies></dependencies> ------</project>

artifactId

version

Comarch.ws fb-8.4-SNAPSHOT .war

Package


Figure:The Project Object Model •

Build Environment:

The build environment consists of profiles that can be activated for use in different environments. For example,during development we may want to deploy a development server,whereas in production we want to deploy a production server.

The build environment customizes the build settings for specific environments and is often supplemented by a custom settings.xml in ~/.m2

POM Relationships:

A project rarely stands alone;it depends on other projects,inherits POM settings from parent projects,defines its own coordinates,and may include submodules. Three types of relationships between the projects • Parent • Dependency • Transitive Dependencies

Parent – The project inherits some attributes from another project. Maven's Super POM:

The Super POM is Marven's default POM. All POMs extend the Super POM unless explicitly set, meaning the configuration specified in the Super POM is inherited by the POMs we created for our projects.


Super POM

Project POM

• • •

This Super POM is a part of the Maven installation and can be found in the maven2.0.9-uber.jar file in $[M2_HOME]/lib. Every POM without a <parent/> implicitly inherits from the Super POM. It defines the central repo,both for dependencies and plugins.

Example: Project POM: <project> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>masterpom</artifactId> <groupId>com.clickandbuy</groupId> <version>8.0</version> </parent> <groupId>com.clickandbuy</groupId> <artifactId>kernel</artifactId> <version>fb-8.4</version> <packaging>war</packaging> </project>

Master POM: <project> <modelVersion>4.0.0</modelVersion> <groupId>com.clickandbuy</groupId> <artifactId>masterpom</artifactId> <packaging>pom</packaging> <version>8.0</version> --------------------<dependencies> --------------------</dependencies>


-----------------------</project>

Dependency Management Model:

Maven is dependency management tool.

Dependency management is one of the features of Maven that is best known to users and is one of the areas where Maven excels. There is not much difficulty in managing dependencies for a single a project, but when we start getting into dealing with multimodule projects and applications that consist of tens or hundreds of modules this is where Maven can help you a great deal in maintaining a high degree of control and stability. Dependency is identified by a group id,an artifact id,a version,an artifact type.

Example: <dependencies>

<dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.0.0.RC1</version> </dependency> </dependencies> Maven will download the dependency JAR from a repository and copy it to the local repository. By default Maven downloads artifacts required by the project or itself from the central. Downloaded artifacts are stored in the local repository.

Artifact Look for spring-core Repository (Local) Build

Look for spring-core

Artifact Repository (Remote)


Transitive Dependencies: • • • • •

Transitive dependencies are a new feature in Maven 2.0. A transitive dependency is dependency of dependency. This allows us to avoid needing to discover and specify the libraries that our own dependencies require, and including them automatically. If project-A depends on project-B, which in turn depends on project-C, then project-C is considered a transitive dependency of project-A. Some times, a JAR requires other JARs then Maven can lookup these dependencies from the POM.

Example: commons-logging 1.1

[INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO]

---------------------------------------------------------------Building maven-java task-segment: [dependency:tree] ---------------------------------------------------------------[dependency:tree] be.anova.maven:maven-java:jar:1.0-SNAPSHOT +- commons-logging:commons-logging:jar:1.1:compile | +- log4j:log4j:jar:1.2.12:compile | +- logkit:logkit:jar:1.0.1:compile | +- avalon-framework:avalon-framework:jar:4.1.3:compile | \- javax.servlet:servlet-api:jar:2.3:compile +- junit:junit:jar:3.8.1:test

With transitive dependencies, the graph of included libraries can quickly grow quite large .There is no limit to the number of levels that dependencies can be gathered from, and will only cause a problem if a cyclic dependency is discovered. • For this reason, there are some additional features that will limit which dependencies are included: • Dependency mediation • Dependency management • Dependency scope • Excluded dependencies • Optional dependencies


Repositories :

Figure:Repositories Overview of Maven Repository: • • • • • •

Dependencies are downloaded from repositories via HTTP downloaded dependencies are cached in a local repository. The repository holds the artifacts on which our project depends. Repository follows a simple directory structure • {groupId}/{artifactId}/{version}/{artifactId}-{version}.jar The purpose of maven repository is to serve as an internal private repository of all software libraries used within an organization. The process of publishing a jar into the repository is called "install" in Maven lingo. This install process helps organizations to share internal artifacts across projects in a standard manner. This also holds the basis for continuous integration among interdependent projects.

Types of maven repository: • Local repository - The local repository is created in special directory usually at ${user.home}/.m2/repository and it is a local cache of the remote downloads and the latest build artifacts. • Remote Repository – Any type of repository accessed by a variety of protocols (file://,http://) .http://repo1.maven.org is the central repository. The below figure shows where to get artifacts: project.xml (POM) Get dependencies

1

2

3

Web Server Download artifact Remote Repository


Maven core Check if artifact exists

4

HTTP

Save artifact in Local Rep

Local Repository

Defining a repository: <project> … <repositories> <repository> <id>hyd_upload</id> <url>http://hyd-apps01:8081/nexus/content/groups/india_upload/</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <snapshots> <enabled>false</enabled> </snapshots> <releases> <updatePolicy>never</updatePolicy> <enabled>true</enabled> </releases> <id>central2</id> <name>Maven central repository (2)</name> <url>http://repo1.maven.org/maven2</url> </repository> </repositories> … </project> Deploying jar in Remote Repository: For deploying jars to an external repository, we have to configure the repository url in the pom.xml and the authentication information for connecting to the repository in the settings.xml. Here is an example using scp and username/password authentication: <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany.app</groupId> <artifactId>my-app</artifactId>


<packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>Maven Quick Start Archetype</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> <version>1.0.4</version> </dependency> </dependencies> <build> <filters> <filter>src/main/filters/filters.properties</filter> </filters> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build> <!-| | | --> <distributionManagement> <repository> <id>mycompany-repository</id> <name>MyCompany Repository</name> <url>scp://repository.mycompany.com/repository/maven2</url> </repository> </distributionManagement> </project> <settings 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/xsd/settings-1.0.0.xsd"> ... <servers> <server> <id>mycompany-repository</id> <username>jvanzyl</username> <!-- Default value is ~/.ssh/id_dsa -->


<privateKey>/path/to/identity</privateKey> (default is ~/.ssh/id_dsa) <passphrase>my_key_passphrase</passphrase> </server> </servers> ... </settings> Note that if we are connecting to an open ssh ssh server which has the parameter "PasswordAuthentication" set to "no" in the sshd_confing, we will have to type our password each time for username/password authentication (although we can log in using another ssh client by typing in the username and password). we might want to switch to public key authentication in this case. Overview of Settings file: Here is a overview of the placement of the different elements in the Maven settings file: <settings> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <proxies> <proxy> <active/> <protocol/> <username/> <password/> <port/> <host/> <nonProxyHosts/> <id/> </proxy> </proxies> <servers> <server> <username/> <password/> <privateKey/> <passphrase/> <filePermissions/> <directoryPermissions/> <configuration/> <id/> </server> </servers> <mirrors> <mirror> <mirrorOf/> <name/> <url/> <id/>


</mirror> </mirrors> <profiles> <profile> <activation> <activeByDefault/> <jdk/> <os> <name/> <family/> <arch/> <version/> </os> <property> <name/> <value/> </property> <file> <missing/> <exists/> </file> </activation> <properties/> <repositories> <repository> <releases> <enabled/> <updatePolicy/> <checksumPolicy/> </releases> <snapshots> <enabled/> <updatePolicy/> <checksumPolicy/> </snapshots> <id/> <name/> <url/> <layout/> </repository> </repositories> <pluginRepositories> <pluginRepository> <releases> <enabled/> <updatePolicy/> <checksumPolicy/> </releases> <snapshots> <enabled/> <updatePolicy/> <checksumPolicy/>


</snapshots> <id/> <name/> <url/> <layout/> </pluginRepository> </pluginRepositories> <id/> </profile> </profiles> <activeProfiles/> <pluginGroups/> </settings>

Looking into a Maven Local repository:


Advantages of Maven Repository: • • • •

Reduced likelihood of version conflicts A single central reference repository of all dependent software libraries rather than several independent local libraries It is quicker to do a clean build when using an internal repository as maven artifacts are retrieved from a server on the INTRANET rather than the ibiblio server on the INTERNET Less manual intervention required for doing a build first time

Maven plugins and Goals:

• •

Plugins are used to interact with a host application to provide a specific task on demand. Maven provides a plugin execution framework and all work is done by plugins i.e. real action is performed by plugins like compile code, create jar files, create war files, unit test code, create project documentation etc

A plugin provides a set of goals that can be executed using the following syntax: mvn [plugin-name]:[goal-name]

A Maven Plugin is a collection of one or more goals. Examples of Maven plugins can be simple core plugins like the Jar plug-in, which contains goals for creating JAR files,Compiler plug-in, which contains goals for compiling source code and unit tests, or the Surefire plugin, which contains goals for executing unit tests and generating reports.

Figure:A Plugin Contains Goals Available Plugins: Maven is a plugin execution framework;all work is done by plugins. There are the build and reporting plugins. • •

Build plugins will be executed during the build and they should be configured in the <build/> element from the POM. Reporting plugins will be executed during the site generation and they should be configured in the <reporting/> element from the POM. Because the result of a Reporting plugin is part of the generated site, Reporting plugins should be both


internationalized and localized. Build Plugins:

Plugin

Description

clean

Clean up after the build.

compiler

Compiles Java sources.

deploy

Deploy the built artifact to the remote repository.

install

Install the built artifact into the local repository.

resources

Copy the resources to the output directory for including in the JAR.

site

Generate a site for the current project.

surefire

Run the Junit tests in an isolated classloader.

verifier

Verifies the existence of certain conditions.

Reporting Plugins:

Plugin

Description

changelog

Generate a list of recent changes from your SCM.

changes

Generate a report from issue tracking or a change document.

checkstyle

Generate a checkstyle report.

clover

Generate a Clover report.

doap

Generate a DOAP file from a POM.

docck

Documentation checker plugin.

javadoc

Generate Javadoc for the project.

jxr

Generate a source cross reference.

pmd

Generate a PMD report.

project-info-reports

Generate a standard project reports.

surefire-report

Generate a report based on the results of unit tests.

Plugins Supported By The Maven Project:

plugin maven-archetype-plugin maven-assembly-plugin maven-clean-plugin maven-compiler-plugin maven-dependency-plugin maven-deploy-plugin

Usage


maven-eclipse-plugin 1.maven-archetype-plugin: The Archetype Plugin allows the user to create a Maven project from an existing template called an archetype. It also allows the user to create an archetype from an existing project. The archetype plugin has four goals: • • • •

archetype-create: creates a Maven project from an archetype. It use the behaviour of the Archetype Plugin version 1.0-alpha-7. archetype-generate : creates a Maven project from an archetype: asks the user to choose an archetype from the archetype catalog, and retrieves it from the remote repository. Once retrieved, it is processed to create a working Maven project. archetype-create-from-project : creates an archetype from an existing project. archetype-crawl : search a repository for archetypes and updates a catalog.

Usage of generate goal: Description: Generates a new project from an archetype. Syntax: mvn archetype:generate \ -DgroupId= -DartifactId= -Dversion= -DpackageName= -DarchetypeGroupId=archeTypeGroupId -DarchetypeArtifactId=archeTypeArtifactId -DarchetypeVersion=archetypeVersion -DinteractiveMode=interactiveMode

Parameters Details:

archetypeArtifactId: The archetype's artifactId. • Type: java.lang.String • Required: No • Expression : ${archetypeArtifactId}

archetypeGroupId: The archetype's groupId. • Type: java.lang.String • Required: No • Expression :: ${archetypeGroupId}

archetypeRepository: The archetype's repository. • Type: java.lang.String • Required: No • Expression : ${archetypeRepository}


archetypeVersion: The archetype's version. • Type: java.lang.String • Required: No • Expression : ${archetypeVersion}

interactiveMode: User settings use to check the interactiveMode. • Type: java.lang.Boolean • Required: Yes • Expression : ${interactiveMode} • Default: ${settings.interactiveMode}

Example: kavaturu@HYD-LNUX08:~$ mvn archetype:create -DgroupId=com.clickandbuy -DartifactId=cnb-portal -DarchetypeArtifactId=maven-archetype-webapp [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] -----------------------------------------------------------------------[INFO] Building Maven Default Project [INFO]

task-segment: [archetype:create] (aggregator-style)

[INFO] -----------------------------------------------------------------------[INFO] [archetype:create {execution: default-cli}] [WARNING] This goal is deprecated. Please use mvn archetype:generate instead [INFO] Defaulting package to group ID: com.clickandbuy [INFO] artifact org.apache.maven.archetypes:maven-archetype-webapp: checking for updates from hyd_upload [WARNING] repository metadata for: 'artifact org.apache.maven.archetypes:mavenarchetype-webapp' could not be retrieved from repository: hyd_upload due to an error: Error transferring file: No route to host [INFO] Repository 'hyd_upload' will be blacklisted


[INFO] ---------------------------------------------------------------------------[INFO] Using following parameters for creating project from Old (1.x) Archetype: mavenarchetype-webapp:RELEASE [INFO] ---------------------------------------------------------------------------[INFO] Parameter: groupId, Value: com.clickandbuy [INFO] Parameter: packageName, Value: com.clickandbuy [INFO] Parameter: package, Value: com.clickandbuy [INFO] Parameter: artifactId, Value: cnb-web-portal [INFO] Parameter: basedir, Value: /home/FIRSTGATE/kavaturu [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] project created from Old (1.x) Archetype in dir: /home/FIRSTGATE/kavaturu/cnbweb-portal [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESSFUL [INFO] -----------------------------------------------------------------------[INFO] Total time: 5 seconds [INFO] Finished at: Thu May 05 17:18:14 IST 2011 [INFO] Final Memory: 11M/495M [INFO] -----------------------------------------------------------------------kavaturu@HYD-LNUX08:~$


Goto Eclipse and Select Import>


Click > Finish 2.maven-clean-plugin: The Clean Plugin is used when we want to remove files generated at build-time in a project's directory. The Clean Plugin only has one goal. • clean:clean - attempts to clean project's working directory of the files that we are generated at build-time. Usage of clean goal: Description:The Maven Clean Plugin, as the name implies, attempts to clean the files and directories generated by Maven during its build. While there are plugins that generate additional files, the Clean Plugin assumes that these files are generated inside the target directory. mvn clean:clean Whereas the first clean refers to plugin's alias and second clean refers to goal. Example: Go To work space directory and use the below command: kavaturu@HYD-LNUX08:~$ cd cnb-portal/ kavaturu@HYD-LNUX08:~/cnb-portal$ mvn clean [INFO] Scanning for projects... [INFO] -----------------------------------------------------------------------[INFO] Building cnb-portal Maven Webapp [INFO]

task-segment: [clean]

[INFO] -----------------------------------------------------------------------[INFO] [clean:clean {execution: default-clean}] [INFO] Deleting file set: /home/FIRSTGATE/kavaturu/cnb-portal/target (included: [**], excluded: []) [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESSFUL [INFO] -----------------------------------------------------------------------[INFO] Total time: 1 second [INFO] Finished at: Thu May 05 18:13:50 IST 2011


[INFO] Final Memory: 6M/495M [INFO] -----------------------------------------------------------------------kavaturu@HYD-LNUX08:~/cnb-portal$

3.maven-eclipse-plugin: • • •

The Eclipse Plugin is used to generate Eclipse IDE files (*.classpath, *.wtpmodules and the .settings folder) for use with a project. Generates the following eclipse configuration files. The Maven Eclipse Plugin has several goals. • eclipse:configure-workspace - is used to add the classpath variable M2_REPO to Eclipse which points to your local repository and optional to configure other workspace features. • eclipse:eclipse - generates the Eclipse configuration files. • eclipse:clean - is used to delete the files used by the Eclipse IDE.

Usage of eclipse goal: mvn eclipse:eclipse Example: kavaturu@HYD-LNUX08:~/cnb-portal$ mvn eclipse:eclipse [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'eclipse'. [INFO] -----------------------------------------------------------------------[INFO] Building cnb-portal Maven Webapp [INFO]

task-segment: [eclipse:eclipse]

[INFO] -----------------------------------------------------------------------[INFO] Preparing eclipse:eclipse [INFO] No goals needed for project - skipping [INFO] [eclipse:eclipse {execution: default-cli}] [INFO] Using Eclipse Workspace: /home/FIRSTGATE/kavaturu [INFO] no substring wtp server match. [INFO] Using as WTP server : SpringSource tc Server (Runtime) v6.0


[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER [INFO] Not writing settings - defaults suffice [INFO] File /home/FIRSTGATE/kavaturu/cnb-portal/.project already exists. Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be removed. [INFO] Wrote Eclipse project for "cnb-portal" to /home/FIRSTGATE/kavaturu/cnb-portal. [INFO] [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESSFUL [INFO] -----------------------------------------------------------------------[INFO] Total time: 2 seconds [INFO] Finished at: Thu May 05 18:08:13 IST 2011 [INFO] Final Memory: 9M/495M [INFO] -----------------------------------------------------------------------kavaturu@HYD-LNUX08:~/cnb-portal$

mvn eclipse:clean Example: kavaturu@HYD-LNUX08:~/cnb-portal$ mvn eclipse:clean [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'eclipse'. [INFO] -----------------------------------------------------------------------[INFO] Building cnb-portal Maven Webapp [INFO]

task-segment: [eclipse:clean]

[INFO] -----------------------------------------------------------------------[INFO] [eclipse:clean {execution: default-cli}]


[INFO] Deleting file: .project [INFO] Deleting file: .classpath [INFO] Deleting file: .wtpmodules [INFO] Deleting file: .component [INFO] Deleting file: org.eclipse.wst.common.component [INFO] Deleting file: org.eclipse.wst.common.project.facet.core.xml [INFO] Deleting file: org.eclipse.jdt.core.prefs [INFO] Deleting file: org.eclipse.ajdt.ui.prefs [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESSFUL [INFO] -----------------------------------------------------------------------[INFO] Total time: 2 seconds [INFO] Finished at: Thu May 05 18:22:34 IST 2011 [INFO] Final Memory: 9M/495M [INFO] -----------------------------------------------------------------------kavaturu@HYD-LNUX08:~/cnb-portal$

3.maven-package-plugin: mvn package Example: kavaturu@HYD-LNUX08:~/cnb-portal$ mvn package [INFO] Scanning for projects... [INFO] -----------------------------------------------------------------------[INFO] Building cnb-portal Maven Webapp [INFO]

task-segment: [package]

[INFO] -----------------------------------------------------------------------[INFO] [resources:resources {execution: default-resources}]


[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [compiler:compile {execution: default-compile}] [INFO] No sources to compile [INFO] [resources:testResources {execution: default-testResources}] [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/FIRSTGATE/kavaturu/cnbportal/src/test/resources [INFO] [compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO] [surefire:test {execution: default-test}] [INFO] No tests to run. [INFO] [war:war {execution: default-war}] [INFO] Packaging webapp [INFO] Assembling webapp[cnb-portal] in [/home/FIRSTGATE/kavaturu/cnbportal/target/cnb-portal] [INFO] Processing war project [INFO] Copying webapp resources[/home/FIRSTGATE/kavaturu/cnbportal/src/main/webapp] [INFO] Webapp assembled in [96 msecs] [INFO] Building war: /home/FIRSTGATE/kavaturu/cnb-portal/target/cnb-portal.war [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESSFUL [INFO] -----------------------------------------------------------------------[INFO] Total time: 2 seconds [INFO] Finished at: Thu May 05 18:29:00 IST 2011


[INFO] Final Memory: 11M/495M [INFO] -----------------------------------------------------------------------kavaturu@HYD-LNUX08:~/cnb-portal$

4.maven-install-plugin: • •

The Install Plugin is used during the install phase to add artifact(s) to the local repository. The Install Plugin uses the information in the POM (groupId, artifactId, version) to determine the proper location for the artifact within the local repository. The local repository is the local cache where all artifacts needed for the build are stored. By default, it is located within the user's home directory (~/.m2/repository) but the location can be configured in ~/.m2/settings.xml using the <localRepository> element. The Install Plugin has 3 goals: • install:install • install:install-file • install:help

Usage of install plugin: mvn install:install Example: kavaturu@HYD-LNUX08:~/cnb-portal$ mvn install [INFO] Scanning for projects... [INFO] -----------------------------------------------------------------------[INFO] Building cnb-portal Maven Webapp [INFO]

task-segment: [install]

[INFO] -----------------------------------------------------------------------[INFO] [resources:resources {execution: default-resources}] [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [compiler:compile {execution: default-compile}] [INFO] No sources to compile [INFO] [resources:testResources {execution: default-testResources}]


[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/FIRSTGATE/kavaturu/cnbportal/src/test/resources [INFO] [compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO] [surefire:test {execution: default-test}] [INFO] No tests to run. [INFO] [war:war {execution: default-war}] [INFO] Packaging webapp [INFO] Assembling webapp[cnb-portal] in [/home/FIRSTGATE/kavaturu/cnbportal/target/cnb-portal] [INFO] Processing war project [INFO] Copying webapp resources[/home/FIRSTGATE/kavaturu/cnbportal/src/main/webapp] [INFO] Webapp assembled in [135 msecs] [INFO] Building war: /home/FIRSTGATE/kavaturu/cnb-portal/target/cnb-portal.war [INFO] [install:install {execution: default-install}] [INFO] Installing /home/FIRSTGATE/kavaturu/cnb-portal/target/cnb-portal.war to /home/FIRSTGATE/kavaturu/.m2/repository/com/clickandbuy/cnb-portal/1.0SNAPSHOT/cnb-portal-1.0-SNAPSHOT.war [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESSFUL [INFO] -----------------------------------------------------------------------[INFO] Total time: 3 seconds [INFO] Finished at: Thu May 05 18:25:04 IST 2011 [INFO] Final Memory: 11M/495M [INFO] -----------------------------------------------------------------------kavaturu@HYD-LNUX08:~/cnb-portal$



Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.