Maven build not running - maven-2

i have created a maven build of my project.The build was succesfull.But when i deploy it on server (apache tomcat 6) it gives various errors regarding jar files.But those jar files are available on the class path.But when i keep those jar files in the lib directory of server then that error gets resolved.So,anyone having any idea regarding this..I have done anything wrong in building using maven.
My pom.xml
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
Test1
Test1
0.0.1-SNAPSHOT
war
Test1
http://maven.apache.org
<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-core</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.10</version>
</dependency>
<dependency>
<groupId>org.ow2.orchestra.eclipse.birt</groupId>
<artifactId>org.ow2.orchestra.eclipse.birt.core</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>org.ow2.orchestra.eclipse.birt</groupId>
<artifactId>org.ow2.orchestra.eclipse.birt.report.engine</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>openforecast</groupId>
<artifactId>openforecast</artifactId>
<version>1.0.16</version>
<scope>system</scope>
<systemPath>D:/testing/WebContent/WEB-INF/lib/OpenForecast-0.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>net.sf.jsci</groupId>
<artifactId>jsci</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-taglib</artifactId>
<version>1.3.10</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>struts</groupId>
<artifactId>struts-bean</artifactId>
<version>1.2.7</version>
<type>tld</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<properties>
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
</properties>
<encoding>ISO-8859-1</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>D:/Test1/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>

You don't deploy a jar on a Tomcat : you deploy a war file.
The war contains a WEB-INF/lib folder which contains your libraries.
The lib folder at the Tomcat root is used only for libraries shared between all deployed applications. For example, the database driver.
Check that your Maven dependencies are not in scope provided.
They should be included in your WEB-INF/lib folder.

First things like your dependency to the servlet api:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
Must have a scope "provided" like this which means they will be needed for compiling but in the runtime it will be provided by Tomcat in this case.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
The following:
openforecast
openforecast
1.0.16
system
D:/testing/WebContent/WEB-INF/lib/OpenForecast-0.5.0.jar
indicates you are not using a Repository which is a real must. Never use system scoped dependencies in your build, cause they will make you build environment specific.
Start using a repository manager (Nexus, Artifactory or Archive) and install the openforecast there.
And it's bad practice to define repositories in your pom and in particular Maven Central like you did.
If you have defined the following in your pom as you have:
<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>
The configuration of the maven-compiler-plugin is not needed like this, cause the encoding parameter uses as default the above property.
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<properties>
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
</properties>
<encoding>ISO-8859-1</encoding>
</configuration>
</plugin>
you can use the following:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
But you must define the version of your used plugins:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
The best to do is using a pluginManagement section.
One other thing which comes to my mind is that your are using an old maven-war-plugin and you are using absolute paths in your configuration which you should avoid under any circumstances.
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>D:/Test1/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
The up-to-date version is 2.2 as the web-site says. If you need to exclude things like this you should do it in the following way:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<packagingExcludes>${basedir}/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
But in this case i don't understand why you like to exclude the web.xml, cause it's an essential part of a war file. May be you can elaborate that a little bit more.

Related

Unable to set the path to bin, lib for selenium (maven) project for jenkins

Trying to run selenium test cases. Which ever document i have seen, suggestion is to add path to bin and lib directory.
Set projectLocation=F:\Selenium\TestNGBatchExample
cd %projectLocation%
set classpath=%projectLocation%\bin;%projectLocation%\lib\*
java org.testng.TestNG %projectLocation%\testng.xml
pause
But in maven project, there is no bin, lib folders in my maven project. Is there any mistake being done in exporting the projecting or any other place. Test cases run perfectly in local environment when executed from eclipse.
<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>automationtests360</groupId>
<artifactId>s360test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>page factory in simplify360</name>
<description>page factory in simplify360</description>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.0-beta2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.0.0-beta2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.0.0-beta2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.0.0-beta2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.52.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.3</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.36</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
To execute testNg.xml file via Maven, you can use surefire plugin. Add below lines in plugins > configuration section of your pom.xml file, if you have not already.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>

Cargo: Delete a File from Container

Is it possible to delete a Library from the container/application-server used by cargo?
I am using TomEE, but always exclude the Library lib\slf4j-jdk14-1.7.5.jar because I am using Logback overall in the container. Now I want to use Cargo for testing purposes, but through artifactInstaller it downloads the complete Tomee-1.6.0 package and I do not see, how I could delete the slf4j-jdk14 dependency.
Is there a possibility within the Cargo-Maven plugin?
Or perhaps a maven configuration task?
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.8</version>
<configuration>
<container>
<containerId>tomcat7x</containerId>
<artifactInstaller>
<groupId>org.apache.openejb</groupId>
<artifactId>apache-tomee</artifactId>
<version>1.6.0</version>
<classifier>plus</classifier>
</artifactInstaller>
<timeout>3000000</timeout>
<systemProperties>
<environment>ci</environment>
</systemProperties>
<log/>
<output/>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>aqapi</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
</dependencies>
</container>
<configuration>
<properties>
<cargo.servlet.port>${custom.http.port}</cargo.servlet.port>
<cargo.tomcat.ajp.port>${custom.ajp.port}</cargo.tomcat.ajp.port>
<cargo.rmi.port>${custom.rmi.port}</cargo.rmi.port>
<cargo.jvmargs>-Xms256m -Xmx1500m -XX:MaxPermSize=384m</cargo.jvmargs>
</properties>
<configfiles>
<configfile>
<file>src/test/tomee/conf/tomee.xml</file>
<todir>conf</todir>
</configfile>
<configfile>
<file>src/test/tomee/logging.properties</file>
<todir>conf</todir>
</configfile>
<configfile>
<file>src/test/tomee/logback.xml</file>
<todir>shared/classes</todir>
</configfile>
</configfiles>
</configuration>
<deployables>
<deployable>
<groupId>de.test</groupId>
<artifactId>test-war</artifactId>
<type>war</type>
<properties>
<context>test-war</context>
</properties>
</deployable>
</deployables>
</configuration>

Compile JasperReports jrxml with scriptlet dependency in same project via Maven

I have a report project that gets compiled, packaged, and included in a war. I use the jasperreports-maven-plugin to compile the JasperReports templates in the report project. I have an issue with a circular dependency where one of the templates requires a scriptlet class in the same project, but the scriptlet class does not get compiled before the reports and I get a ClassNotFound exception during compilation. Is there a way to compile the class first before the templates or some other workaround besides declaring a system dependency to a previously compiled version of the jar?
Here is my 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>
<artifactId>report</artifactId>
<name>report</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<configuration>
<artifactItems>
<artifactItem>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
<artifactItem>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
<artifactItem>
<groupId>ar.com.fdvs</groupId>
<artifactId>DynamicJasper</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile-reports</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>${project.build.directory}/generated-jasper</outputDirectory>
<sourceDirectory>src/main/resources/com/example/report/</sourceDirectory>
<compiler>net.sf.jasperreports.compilers.JRGroovyCompiler</compiler>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- use this if you have a report dependency at compile time -->
<!--
<dependency>
<groupId>com.example.usedforcompilingjasperreports</groupId>
<artifactId>compilejasperreports</artifactId>
<scope>system</scope>
<version>0.0.1</version>
<systemPath>${basedir}/src/main/resources/com/example/report/lib/report-${version}.jar</systemPath>
</dependency>
-->
</dependencies>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
jasperreports-maven-plugin
</artifactId>
<versionRange>
[1.0-beta-2,)
</versionRange>
<goals>
<goal>compile-reports</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.6.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.6.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>persistence</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ar.com.fdvs</groupId>
<artifactId>DynamicJasper</artifactId>
<version>3.1.9</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<!-- not used but necessary to avoid an unexpected compiletion exception
An exception has occurred in the compiler (1.6.0_04). Please file a bug at
the Java Developer Connection (http://java.sun.com/webapps/bugreport) after
checking the Bug Parade for duplicates. Include your program and the following
diagnostic in your report. Thank you. com.sun.tools.javac.code.Symbol$CompletionFailure:
class file for javax.persistence.CascadeType not found -->
<groupId>org.hibernate</groupId>
<artifactId>ejb3-persistence</artifactId>
<version>1.0.1.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.12</version>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.15</version>
</dependency>
<dependency>
<groupId>com.force.api</groupId>
<artifactId>force-wsc</artifactId>
<version>22.0.0</version>
</dependency>
<dependency>
<groupId>com.sforce.soap</groupId>
<artifactId>salesforce-webservices</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<parent>
<groupId>com.example</groupId>
<artifactId>assemble</artifactId>
<version>2.2.0-SNAPSHOT</version>
<relativePath>../assemble/pom.xml</relativePath>
</parent>
</project>
Thank you,
Tom
This might be a tad late, but I think you could try to bind the execution of the jasperreports-maven-plugin to a later maven build phase.
By default it runs at the generate-resources phase, at which time the java classes have not yet been compiled.
Check out the paragraph below the code box on this page.

Maven artifacts could not be resolved

I added the spring and jboss repositories to my pom.xml like below:
<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">
<name>MyProject</name>
<url>http://www.myproject.com</url>
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>myproject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.3-b02</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.3_01</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.0.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0-alpha-1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<!-- SPRING DEPENDENCIES -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<!-- HIBERNATE DEPENDENCIES -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.5.4-Final</version>
</dependency>
<!-- PRIMEFACES -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.0.M4</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>aristo</artifactId>
<version>1.0.1</version>
</dependency>
<!-- OTHER DEPENDENCIES -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.authorize</groupId>
<artifactId>java-anet-sdk</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.2.12</version>
</dependency>
<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>prettyfaces-jsf2</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.hint.j2eeVersion>1.6</netbeans.hint.j2eeVersion>
<netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
</properties>
<repositories>
<repository>
<id>jsf20</id>
<name>Repository for library Library[jsf20]</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>spring-release</id>
<name>Spring Release Repository</name>
<url>http://maven.springframework.org/release</url>
<layout>default</layout>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</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>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
<!--pluginRepositories>
<pluginRepository>
<id>caucho</id>
<name>Caucho</name>
<url>http://caucho.com/m2</url>
</pluginRepository>
</pluginRepositories-->
</project>
But when I build, I get an error:
The following artifacts could not be resolved: org.springframework:spring:jar:3.0.6.RELEASE, org.hibernate:hibernate:jar:3.5.4-Final: Could not find artifact org.springframework:spring:jar:3.0.6.RELEASE in jsf20 (http://download.java.net/maven/2/) -> [Help 1]
It's like maven only looks at the first repository and not the ones defined for spring and hibernate.
Update: Ran with -X and -e options at command line but not very useful from what I can tell: http://pastebin.com/c7nPzBc2
That error just says it cant be found at the java.net repo, it should continue on and check the others until it finds one that does have it. You should be able to safely ignore that.
Also, the url you have listed for spring appears to be dead, it gives me error 500 when i try to go there directly. Either way, its unnecessary as the spring artifacts can be found in maven central (at least through 3.0.6 which you are listing as your dependency).
After a little more investigation, i find that spring has not published a spring artifact since 2.5.6. You will need to specify each artifact individually. For example:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
...

Unable to Deploy war using maven 3.x

I am trying to deploy my web-application to tomcat using maven 3.x here is the snap shot of the pom.xml file
<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.demo</groupId>
<artifactId>demoapp</artifactId>
<version>2.2.3</version>
<packaging>war</packaging>
<name>Blank Webapp</name>
<properties>
<struts2.version>2.2.3</struts2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>${struts2.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<warFile>${project.build.directory}/${project.build.finalName}.war</warFile>
<url>http://localhost:8080/manager/html</url>
<server>localhost</server>
<path>/WebApp</path>
</configuration>
</plugin>
</plugins>
</build>
</project>
i tried the following goal in maven mvn deploy but i got the following build fail with following error
Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
after doing some googling i added the following entry to my pom.xml
<distributionManagement>
<repository>
<id>myRepoId</id>
<name>myCompanyReporsitory</name>
<!-- <url>scp://nothing/</url>
<url>${user.home}/m2/repository</url> -->
</repository>
</distributionManagement>
but i am not sure what should be the URL since using ${user.home}/m2/repository gave another error with build failure
Failed to deploy artifacts/metadata: No connector available to access repository myRepoId (C:\Users\admin/m2/repository) of type default using the available factories WagonRepositoryConnectorFactory -> [Help 1]
How to solve the problem?
The mvn deploy tries to send the result of the package goal to the url of repository described in your POM.
I aims not at deploying a Web application on its server but to share the library produced with other.
If what you need is to deploy you webapp, then the tomcat plugin is a solution.
BTW: The connector issue when trying to deploy is due to the fact that to enable SCP you need to add the wagon-scp connector.