I'm working with the javaee tutorials with glassfish and maven. I can get the example to run fine. What I'm trying to do is recreate the same example from scratch which I have done. (created by opening a new maven project in netbenas
With the examples though, from command line when I mvn install
the example app automatically gets deployed on the glassfish server. I'm thinking the reason fort his is that the example file is already placed in the glassfish directory
C:\
glassfish4
docs
javaee-tutorial
examples
web
jsf
hello1 (target application)
Now my project is being created in a different NetBeansProjects directory
C:\
netbeansprojects
javaee_tuts
practiceproject (target application)
The example
project gets automatically deployed, but my practiceproject
doesn't get deployed. I'm guessing because the project is not in the glassfish directory or it could a combination of this and other things, of which I'm not sure. I thought maybe I could configure it somehow with the pom.xml
but I'm very new to maven, and not too familiar with the pom
.
Here are the two pom
s
example pom
<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>
<parent>
<artifactId>jsf</artifactId>
<groupId>org.glassfish.javaeetutorial</groupId>
<version>7.0.3</version>
</parent>
<groupId>org.glassfish.javaeetutorial</groupId>
<artifactId>hello1</artifactId>
<version>7.0.3</version>
<packaging>war</packaging>
<name>${project.artifactId}</name>
</project>
My practiceproject pom
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mavenpractice</groupId>
<artifactId>practiceproject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>practiceproject</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I can get the project to deploy through netbeans, that's no problem, but I want to practice using maven through command line. So to conclude with a single question:
What do I need to do to get my practice project to auto deploy on glassfish using
mvn install
from command line?