Skip to content

Instantly share code, notes, and snippets.

@massahud
Last active December 14, 2015 08:39
Show Gist options
  • Save massahud/5059640 to your computer and use it in GitHub Desktop.
Save massahud/5059640 to your computer and use it in GitHub Desktop.
pom.xml maven inicial cdi tomcat6 jsf primefaces jpa entitymanager request

Projeto maven inicial CDI Tomcat 6

Contém

  • Arquivos pom.xml, web.xml e context.xml que ativam cdi no tomcat 6. O pom contém também outras APIs que eu normalmente uso em meus projetos, além de uma lista de repositórios e um repositório local que fica no diretorio lib dentro do projeto.
  • Algumas classes de utilitários para CDI e JPA.

Onde devem ficar os arquivos

  • web.xml, beans.xml, faces-config.xml: src/main/webapp/WEB-INF
  • pom.xml: raiz do projeto
  • context.xml: src/main/webapp/META-INF
  • persistence.xml: src/main/resources/META-INF
  • log4j.cfg.xml, log4j.dtd: src/main/resources/META-INF/log4jconf (nome de diretório pode ser outro)
  • CDIUtil.java, PersistenciaUtil.java: src/main/java/com/massahud/util
  • index.jsp, index.xhtml: src/main/webapp
  • HelloBean.java: src/main/java/com/massahud/hello

Repositório local lib/

o repositorio que fica no lib é local, e deve ter seus jars adicionados manualmente. Os jars dos drivers oracle no pom são adicionados manualmente neste repositório. Para adicionar um jar no repositório local, siga os seguintes passos:

  1. colocar o jar em lib
  2. na raiz do projeto executar
  3. executar mvn deploy:deploy-file -DgroupId= -DartifactId= -Dversion= -Dpackaging=jar -Dfile=lib/.jar -Durl=file://${project.basedir}/lib -DrepositoryId=local-project-libraries
  4. apagar o jar do lib, pois ele foi copiado para o diretorio do grupo dentro do repositorio local.

Exemplo:

  • Dependencia no pom:
    <dependencies>
      <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0.3.0</version>
      </dependency>
    </dependencies>    
  • Arquivo jar: lib/ojdbc6.jar
  • Linha de comando mvn deploy:deploy-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3.0 -Dpackaging=jar -Dfile=lib/ojdbc6.jar -Durl=file://${project.basedir}/lib -DrepositoryId=local-project-libraries
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:weld="http://jboss.org/schema/weld/beans"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<!-- exclui alguns pacotes do scan do Weld para ir mais rápido -->
<weld:scan>
<weld:exclude name="org.primefaces.**" />
<weld:exclude name="org.eclipse.**" />
<weld:exclude name="com.sun.**" />
<weld:exclude name="org.apache.**" />
<weld:exclude name="oracle.**" />
<weld:exclude name="org.hibernate.**" />
<weld:exclude name="org.**" />
</weld:scan>
</beans>
package com.massahud.util;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
* Classe de utilidades CDI
*
* @author Geraldo Massahud
*/
public class CDIUtil {
/**
* JNDI do beanManager
*/
private static final String BEAN_MANAGER_JNDI = "java:comp/BeanManager";
/**
* JNDI fallback do beanManager, caso o primeiro não funcione (caso do
* tomcat)
*/
private static final String BEAN_MANAGER_FALLBACK_JNDI = "java:comp/env/BeanManager";
/**
* Obtém o BeanManager via JNDI
*
* @return BeanManager
*/
public static BeanManager lookupBeanManager() {
InitialContext ctx = null;
BeanManager bm = null;
try {
ctx = new InitialContext();
bm = (BeanManager) ctx.lookup(BEAN_MANAGER_JNDI);
} catch (NamingException e) {
if (ctx != null) {
try {
bm = (BeanManager) ctx.lookup(BEAN_MANAGER_FALLBACK_JNDI); // development
// mode
} catch (NamingException e1) {
}
}
if (null == bm) {
throw new RuntimeException("Failed to locate BeanManager", e);
}
}
return bm;
}
/**
* Obtém um bean da classe especifica programaticamente
*
* @param <T> classe do bean
* @param beanManager o bean manager que irá criar o bean
* @param serviceType classe do bean
* @return
*/
public static <T> T lookupBean(BeanManager beanManager, Class<T> serviceType) {
Bean<?> bean = beanManager.resolve(beanManager.getBeans(serviceType));
if (bean == null) {
return null;
}
return (T) beanManager.getReference(bean, serviceType,
beanManager.createCreationalContext(bean));
}
/**
* Obtém um bean da classe especifica programaticamente
*
* @param <T> classe do bean
* @param serviceType classe do bean
* @return
*/
public static <T> T lookupBean(Class<T> serviceType) {
return lookupBean(lookupBeanManager(), serviceType);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/projetocditomcat6">
<Resource auth="Container" factory="org.jboss.weld.resources.ManagerObjectFactory" name="BeanManager" type="javax.enterprise.inject.spi.BeanManager"/>
</Context>
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
</faces-config>
package com.massahud.hello;
import org.apache.commons.lang3.StringUtils;
import javax.enterprise.inject.Model;
@Model
public class HelloBean {
private String nome = "World";
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getHello() {
String hello = "Hello, " + nome + "!";
return hello + "<br/>" + StringUtils.reverse(hello);
}
}
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello</title>
<meta http-equiv="REFRESH" content="0;url=index.jsf"/>
</head>
<body>
carregando...
</body>
</html>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:pn="http://primefaces.org/ui/extensions"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<title>Hello JSF</title>
</h:head>
<h:body>
<h:form>
<p:panel header="Hello">
<p:inputText id="nome" value="#{helloBean.nome}">
<p:ajax event="keyup" update="hello" />
</p:inputText>
<p:outputPanel layout="block">
<h:outputText escape="false" id="hello" value="#{helloBean.hello}" />
</p:outputPanel>
</p:panel>
</h:form>
</h:body>
</html>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<param name="ImmediateFlush" value="true"/>
<param name="Threshold" value="all"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[CONSOLE] %d{HH:mm:ss} %-5p (%c{3}\:%L) - %m%n"/>
</layout>
</appender>
<appender name="arquivo" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/logs/projetocditomcat6.log"/>
<param name="ImmediateFlush" value="true"/>
<param name="Threshold" value="all"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss} %-5p (%c{3}\:%L) - %m%n"/>
</layout>
</appender>
<logger name="com.massahud">
<level value="trace"/>
</logger>
<root>
<level value="info"/>
<appender-ref ref="stdout" />
<appender-ref ref="arquivo" />
</root>
</log4j:configuration>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Authors: Chris Taylor, Ceki Gulcu. -->
<!-- Version: 1.2 -->
<!-- A configuration element consists of optional renderer
elements,appender elements, categories and an optional root
element. -->
<!ELEMENT log4j:configuration (renderer*, appender*,(category|logger)*,root?,
categoryFactory?)>
<!-- The "threshold" attribute takes a level value such that all -->
<!-- logging statements with a level equal or below this value are -->
<!-- disabled. -->
<!-- Setting the "debug" enable the printing of internal log4j logging -->
<!-- statements. -->
<!-- By default, debug attribute is "null", meaning that we not do touch -->
<!-- internal log4j logging settings. The "null" value for the threshold -->
<!-- attribute can be misleading. The threshold field of a repository -->
<!-- cannot be set to null. The "null" value for the threshold attribute -->
<!-- simply means don't touch the threshold field, the threshold field -->
<!-- keeps its old value. -->
<!ATTLIST log4j:configuration
xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
threshold (all|debug|info|warn|error|fatal|off|null) "null"
debug (true|false|null) "null"
>
<!-- renderer elements allow the user to customize the conversion of -->
<!-- message objects to String. -->
<!ELEMENT renderer EMPTY>
<!ATTLIST renderer
renderedClass CDATA #REQUIRED
renderingClass CDATA #REQUIRED
>
<!-- Appenders must have a name and a class. -->
<!-- Appenders may contain an error handler, a layout, optional parameters -->
<!-- and filters. They may also reference (or include) other appenders. -->
<!ELEMENT appender (errorHandler?, param*, layout?, filter*, appender-ref*)>
<!ATTLIST appender
name ID #REQUIRED
class CDATA #REQUIRED
>
<!ELEMENT layout (param*)>
<!ATTLIST layout
class CDATA #REQUIRED
>
<!ELEMENT filter (param*)>
<!ATTLIST filter
class CDATA #REQUIRED
>
<!-- ErrorHandlers can be of any class. They can admit any number of -->
<!-- parameters. -->
<!ELEMENT errorHandler (param*, root-ref?, logger-ref*, appender-ref?)>
<!ATTLIST errorHandler
class CDATA #REQUIRED
>
<!ELEMENT root-ref EMPTY>
<!ELEMENT logger-ref EMPTY>
<!ATTLIST logger-ref
ref IDREF #REQUIRED
>
<!ELEMENT param EMPTY>
<!ATTLIST param
name CDATA #REQUIRED
value CDATA #REQUIRED
>
<!-- The priority class is org.apache.log4j.Level by default -->
<!ELEMENT priority (param*)>
<!ATTLIST priority
class CDATA #IMPLIED
value CDATA #REQUIRED
>
<!-- The level class is org.apache.log4j.Level by default -->
<!ELEMENT level (param*)>
<!ATTLIST level
class CDATA #IMPLIED
value CDATA #REQUIRED
>
<!-- If no level element is specified, then the configurator MUST not -->
<!-- touch the level of the named category. -->
<!ELEMENT category (param*,(priority|level)?,appender-ref*)>
<!ATTLIST category
class CDATA #IMPLIED
name CDATA #REQUIRED
additivity (true|false) "true"
>
<!-- If no level element is specified, then the configurator MUST not -->
<!-- touch the level of the named logger. -->
<!ELEMENT logger (level?,appender-ref*)>
<!ATTLIST logger
name ID #REQUIRED
additivity (true|false) "true"
>
<!ELEMENT categoryFactory (param*)>
<!ATTLIST categoryFactory
class CDATA #REQUIRED>
<!ELEMENT appender-ref EMPTY>
<!ATTLIST appender-ref
ref IDREF #REQUIRED
>
<!-- If no priority element is specified, then the configurator MUST not -->
<!-- touch the priority of root. -->
<!-- The root category always exists and cannot be subclassed. -->
<!ELEMENT root (param*, (priority|level)?, appender-ref*)>
<!-- ==================================================================== -->
<!-- A logging event -->
<!-- ==================================================================== -->
<!ELEMENT log4j:eventSet (log4j:event*)>
<!ATTLIST log4j:eventSet
xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
version (1.1|1.2) "1.2"
includesLocationInfo (true|false) "true"
>
<!ELEMENT log4j:event (log4j:message, log4j:NDC?, log4j:throwable?,
log4j:locationInfo?) >
<!-- The timestamp format is application dependent. -->
<!ATTLIST log4j:event
logger CDATA #REQUIRED
level CDATA #REQUIRED
thread CDATA #REQUIRED
timestamp CDATA #REQUIRED
>
<!ELEMENT log4j:message (#PCDATA)>
<!ELEMENT log4j:NDC (#PCDATA)>
<!ELEMENT log4j:throwable (#PCDATA)>
<!ELEMENT log4j:locationInfo EMPTY>
<!ATTLIST log4j:locationInfo
class CDATA #REQUIRED
method CDATA #REQUIRED
file CDATA #REQUIRED
line CDATA #REQUIRED
>
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="projetocditomcat6PU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>java:/comp/env/jdbc/MeuDataSource</non-jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<shared-cache-mode>DISABLE_SELECTIVE</shared-cache-mode>
<validation-mode>NONE</validation-mode>
<properties>
<property name="eclipselink.target-database" value="Oracle11"/>
<property name="eclipselink.logging.level" value="INFO"/>
<!--<property name="eclipselink.logging.file" value="/logs/projetocditomcat6.log"/>-->
<property name="eclipselink.logging.parameters" value="true"/>
<property name="eclipselink.ddl-generation" value="none"/>
<property name="eclipselink.ddl-generation.output-mode" value="sql-script"/>
<property name="eclipselink.create-ddl-jdbc-file-name" value="correicao-create-db.sql"/>
<property name="eclipselink.drop-ddl-jdbc-file-name" value="correicao-drop-db.sql"/>
</properties>
</persistence-unit>
</persistence>
package com.massahud.util;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.apache.log4j.Logger;
/**
* Bean de requisição que produz contextos de persistência com escopo de requisição. Também pode
* criar um contexto de persistência sem escopo, que deve ser fechadmo manualmente.
*
* @author Geraldo Massahud
*/
@RequestScoped
public class PersistenciaUtil {
public static String gerarNomeJpql(Enum<?> e) {
return e.getDeclaringClass().getName() + "." + e.name();
}
@Produces
private transient EntityManagerFactory factory = getEntityManagerFactory();
private transient EntityManager em;
@PostConstruct
private void criaEntityManager() {
logger.debug("criaEm");
em = factory.createEntityManager();
}
@PreDestroy
private void fechaEntityManager() {
logger.debug("fechaEm");
if (em.isOpen()) {
em.close();
}
}
Logger logger = Logger.getLogger(PersistenciaUtil.class);
@Produces
public EntityManager getEntityManager() {
return em;
}
/**
* Cria um entity manager manualmente, que não será fechado ao fim do
* contexto de requisição.
*
* É obrigação da classe que usar este método fechar o EntityManager no
* final.
*
* @return contexto de persistência sem escopo
*/
public static EntityManager criarEntityManagerSemContexto() {
return getEntityManagerFactory().createEntityManager();
}
public static EntityManagerFactory getEntityManagerFactory() {
return Persistence.createEntityManagerFactory("projetocditomcat6PU");
}
}
<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.massahud</groupId>
<artifactId>projetocditomcat6</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>projetocditomcat6</name>
<url>http://www.massahud.com/</url>
<dependencies>
<!-- WELD-SERVLET + JSF-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<scope>compile</scope>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>compile</scope>
<version>1.0-SP4</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>1.1.0.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.1.2-b05</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.1.2-b05</version>
<scope>provided</scope>
</dependency>
<!-- FIM WELD-SERVLET + JSF-->
<!-- PRIMEFACES -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>primefaces-extensions</artifactId>
<version>0.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<!-- FIM PRIMEFACES -->
<!-- ORACLE REPOSITORIO LOCAL -->
<!--<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>orai18n</artifactId>
<version>11.2.0.3.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>xdb6</artifactId>
<version>11.2.0.3.0</version>
<type>jar</type>
</dependency>-->
<!-- FIM ORACLE REPOSITORIO LOCAL -->
<!-- ECLIPSELINK -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.oracle</artifactId>
<version>2.4.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.4.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen</artifactId>
<version>2.4.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.0.Final</version>
</dependency>
<!-- FIM ECLIPSELINK -->
<!-- TESTES -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.168</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5-rc1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<!-- FIM TESTES -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgument>-Xlint</compilerArgument>
<compilerArgument>-Xlint:serial</compilerArgument>
<compilerArgument>-Xlint:path</compilerArgument>
<compilerArgument>-Xlint:finally</compilerArgument>
<compilerArgument>-Xlint:deprecation</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<properties>
<property>
<name>listener</name>
<value>org.testng.reporters.DotTestListener</value>
</property>
</properties>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>local-project-libraries</id>
<name>Repositório local do projeto para jars que não estão em um repositório online.</name>
<url>file://${project.basedir}/lib</url>
</repository>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jvnet-nexus-releases</id>
<name>jvnet-nexus-releases</name>
<url>https://maven.java.net/content/repositories/releases/</url>
</repository>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
<repository>
<url>http://download.eclipse.org/rt/eclipselink/maven.repo/</url>
<id>eclipselink</id>
<layout>default</layout>
<name>Repository for library EclipseLink (JPA 2.0)</name>
</repository>
<repository>
<id>jboss-public-jboss-repository-group</id>
<name>JBoss Public Jboss Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<annotation.processing.source.output>target/generated-sources/annotations</annotation.processing.source.output>
<build.generated.sources.dir>target/generated-sources/annotations</build.generated.sources.dir>
<netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
</properties>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
</plugin>
</plugins>
</reporting>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>projetocditomcat6</display-name>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<resource-env-ref>
<description>Object factory for the CDI Bean Manager</description>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment