lsjunior 18 de out. de 2011
Uso o Maven 3 + Eclipse Indigo + Tomcat 7 sem problemas. Um problema que tive logo que migrei pro Indigo foi que o plugin do Maven publicava as dependências marcadas como provided e test no Tomcat.
Mas detalha mais um pouco seu problema, talvez o projeto nem compilando esteja.
brunobuild 18 de out. de 2011
Na verdade estou enfrentando vários problemas.
Consigo fazer subir com o tomcat porém quando eu executo o goal mvn tomcat:run, a aplicação sobe mas ele não encontra as classes compiladas.
Ele não gera os arquivos .class dentro do target
brunobuild 18 de out. de 2011
Ele cria também o projeto com java 1.4
lsjunior 19 de out. de 2011
Tem um archetype que fiz para gerar projetos Maven para o Eclipse Indigo, se quiser testar e ver as diferenças com seu projeto o comando é esse:
mvn archetype : generate - DarchetypeRepository = http : //maven.woodstock.net.br/repos/ -DarchetypeGroupId=br.net.woodstock.rockframework.archetypes -DarchetypeArtifactId=webapp-simple -DarchetypeVersion=1.0 -DgroupId=my.domain -DartifactId=my-app -Dversion=1.0
Será gerado um projeto modularizado da seguinte forma:
my-app/
...my-app-api
...my-app-impl
...my-app-orm
...my-app-util
...my-app-web
Sendo que no seu caso apenas o Web é importante, importe ele para o Eclipse ajuste o pom desse jeito:
<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>my.domain.my-app</groupId>
<artifactId>my-app-web</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<scope>provided</scope>
<version>2.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<scope>compile</scope>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<version>3.8.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<scope>compile</scope>
<version>1.1.2</version>
</dependency>
</dependencies>
</project>
PS: Tive que apagar a classe Index, pois o nome da aplicação tem um carácter especial.
brunobuild 19 de out. de 2011
O meu pom.xml ta assim.
O Plugin do tomcat está configurado certo?
Como eu configuro o target runtime?
& lt ; 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" & gt ;
& lt ; modelVersion & gt ; 4.0 . 0 & lt ; / modelVersion & gt ;
& lt ; groupId & gt ; com . speed . powercrud & lt ; / groupId & gt ;
& lt ; artifactId & gt ; powercrud & lt ; / artifactId & gt ;
& lt ; packaging & gt ; war & lt ; / packaging & gt ;
& lt ; version & gt ; 0.0 . 1 - SNAPSHOT & lt ; / version & gt ;
& lt ; name & gt ; powercrud Maven Webapp & lt ; / name & gt ;
& lt ; url & gt ; http : // maven . apache . org & lt ; / url & gt ;
& lt ; properties & gt ;
& lt ; !-- Version JSF --& gt ;
& lt ; jsfversion & gt ; 2.1 . 2 & lt ; / jsfversion & gt ;
& lt ; !-- Themes Version Primefaces --& gt ;
& lt ; themeversion & gt ; 1.0 . 1 & lt ; / themeversion & gt ;
& lt ; !-- Driver Banco de dados --& gt ;
& lt ; drivermysql & gt ; 5.1 . 18 & lt ; / drivermysql & gt ;
& lt ; / properties & gt ;
& lt ; repositories & gt ;
& lt ; repository & gt ;
& lt ; id & gt ; maven2 - repository . dev . java . net & lt ; / id & gt ;
& lt ; name & gt ; Java . net Repository for Maven & lt ; / name & gt ;
& lt ; url & gt ; http : // download . java . net / maven / 2 & lt ; / url & gt ;
& lt ; / repository & gt ;
& lt ; repository & gt ;
& lt ; id & gt ; prime - repo & lt ; / id & gt ;
& lt ; name & gt ; PrimeFaces Maven Repository & lt ; / name & gt ;
& lt ; url & gt ; http : // repository . primefaces . org & lt ; / url & gt ;
& lt ; layout & gt ; default & lt ; / layout & gt ;
& lt ; / repository & gt ;
& lt ; repository & gt ;
& lt ; id & gt ; spring - milestone & lt ; / id & gt ;
& lt ; name & gt ; Spring Maven MILESTONE Repository & lt ; / name & gt ;
& lt ; url & gt ; http : // maven . springframework . org / milestone & lt ; / url & gt ;
& lt ; / repository & gt ;
& lt ; repository & gt ;
& lt ; id & gt ; JBoss Repo & lt ; / id & gt ;
& lt ; url & gt ; http : // repository . jboss . com & lt ; / url & gt ;
& lt ; / repository & gt ;
& lt ; / repositories & gt ;
& lt ; dependencies & gt ;
& lt ; dependency & gt ;
& lt ; groupId & gt ; junit & lt ; / groupId & gt ;
& lt ; artifactId & gt ; junit & lt ; / artifactId & gt ;
& lt ; version & gt ; 3.8 . 1 & lt ; / version & gt ;
& lt ; scope & gt ; test & lt ; / scope & gt ;
& lt ; / dependency & gt ;
& lt ; dependency & gt ;
& lt ; groupId & gt ; log4j & lt ; / groupId & gt ;
& lt ; artifactId & gt ; log4j & lt ; / artifactId & gt ;
& lt ; version & gt ; 1.2 . 16 & lt ; / version & gt ;
& lt ; scope & gt ; compile & lt ; / scope & gt ;
& lt ; / dependency & gt ;
& lt ; dependency & gt ;
& lt ; groupId & gt ; com . sun . faces & lt ; / groupId & gt ;
& lt ; artifactId & gt ; jsf - api & lt ; / artifactId & gt ;
& lt ; version & gt ; $ { jsfversion } & lt ; / version & gt ;
& lt ; scope & gt ; compile & lt ; / scope & gt ;
& lt ; / dependency & gt ;
& lt ; dependency & gt ;
& lt ; groupId & gt ; com . sun . faces & lt ; / groupId & gt ;
& lt ; artifactId & gt ; jsf - impl & lt ; / artifactId & gt ;
& lt ; version & gt ; $ { jsfversion } & lt ; / version & gt ;
& lt ; scope & gt ; compile & lt ; / scope & gt ;
& lt ; / dependency & gt ;
& lt ; dependency & gt ;
& lt ; groupId & gt ; org . primefaces & lt ; / groupId & gt ;
& lt ; artifactId & gt ; primefaces & lt ; / artifactId & gt ;
& lt ; version & gt ; 3.0 . M3 & lt ; / version & gt ;
& lt ; / dependency & gt ;
& lt ; dependency & gt ;
& lt ; groupId & gt ; org . primefaces . themes & lt ; / groupId & gt ;
& lt ; artifactId & gt ; aristo & lt ; / artifactId & gt ;
& lt ; version & gt ; $ { themeversion } & lt ; / version & gt ;
& lt ; / dependency & gt ;
& lt ; dependency & gt ;
& lt ; groupId & gt ; org . primefaces . themes & lt ; / groupId & gt ;
& lt ; artifactId & gt ; bluesky & lt ; / artifactId & gt ;
& lt ; version & gt ; $ { themeversion } & lt ; / version & gt ;
& lt ; / dependency & gt ;
& lt ; !--
& lt ; dependency & gt ;
& lt ; groupId & gt ; springframework & lt ; / groupId & gt ;
& lt ; artifactId & gt ; spring & lt ; / artifactId & gt ;
& lt ; version & gt ; 2.0 - M4 & lt ; / version & gt ;
& lt ; / dependency & gt ;
& lt ; dependency & gt ;
& lt ; groupId & gt ; org . springframework . security & lt ; / groupId & gt ;
& lt ; artifactId & gt ; spring - security - core & lt ; / artifactId & gt ;
& lt ; version & gt ; 3.0 . 7. RELEASE & lt ; / version & gt ;
& lt ; / dependency & gt ;
--& gt ;
& lt ; dependency & gt ;
& lt ; groupId & gt ; mysql & lt ; / groupId & gt ;
& lt ; artifactId & gt ; mysql - connector - java & lt ; / artifactId & gt ;
& lt ; version & gt ; $ { drivermysql } & lt ; / version & gt ;
& lt ; / dependency & gt ;
& lt ; / dependencies & gt ;
& lt ; build & gt ;
& lt ; plugins & gt ;
& lt ; plugin & gt ;
& lt ; groupId & gt ; org . codehaus . mojo & lt ; / groupId & gt ;
& lt ; artifactId & gt ; tomcat - maven - plugin & lt ; / artifactId & gt ;
& lt ; configuration & gt ;
& lt ; mode & gt ; both & lt ; / mode & gt ;
& lt ; / configuration & gt ;
& lt ; / plugin & gt ;
& lt ; !-- Maven compiler plugin --& gt ;
& lt ; plugin & gt ;
& lt ; artifactId & gt ; maven - compiler - plugin & lt ; / artifactId & gt ;
& lt ; configuration & gt ;
& lt ; source & gt ; 1.6 & lt ; / source & gt ;
& lt ; target & gt ; 1.6 & lt ; / target & gt ;
& lt ; / configuration & gt ;
& lt ; / plugin & gt ;
& lt ; / plugins & gt ;
& lt ; finalName & gt ; powercrud & lt ; / finalName & gt ;
& lt ; / build & gt ;
& lt ; / project & gt ;
lsjunior 19 de out. de 2011
No meu caso o Maven no Eclipse apenas gerencia as dependências, adiciono o Tomcat via Servers/Runtime Environments.
brunobuild 19 de out. de 2011
Estou executando, e ele não está encontrnado os meus ManagedBeans
19 / 10 / 2011 11 : 49 : 03 com . sun . faces . lifecycle . InvokeApplicationPhase execute
AVISO : # { Testando . testando } : javax . el . PropertyNotFoundException : / index . xhtml @13 , 78 action = "#{Testando.testando}" : Target Unreachable , identifier ' Testando ' resolved to null
javax . faces . FacesException : # { Testando . testando } : javax . el . PropertyNotFoundException : / index . xhtml @13 , 78 action = "#{Testando.testando}" : Target Unreachable , identifier ' Testando ' resolved to null
at com . sun . faces . application . ActionListenerImpl . processAction ( ActionListenerImpl . java : 118 )
at javax . faces . component . UICommand . broadcast ( UICommand . java : 315 )
at javax . faces . component . UIViewRoot . broadcastEvents ( UIViewRoot . java : 794 )
at javax . faces . component . UIViewRoot . processApplication ( UIViewRoot . java : 1259 )
at com . sun . faces . lifecycle . InvokeApplicationPhase . execute ( InvokeApplicationPhase . java : 81 )
at com . sun . faces . lifecycle . Phase . doPhase ( Phase . java : 101 )
at com . sun . faces . lifecycle . LifecycleImpl . execute ( LifecycleImpl . java : 118 )
at javax . faces . webapp . FacesServlet . service ( FacesServlet . java : 593 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 304 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 224 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 169 )
at org . apache . catalina . authenticator . AuthenticatorBase . invoke ( AuthenticatorBase . java : 472 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 168 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 100 )
at org . apache . catalina . valves . AccessLogValve . invoke ( AccessLogValve . java : 929 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 118 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 405 )
at org . apache . coyote . http11 . AbstractHttp11Processor . process ( AbstractHttp11Processor . java : 964 )
at org . apache . coyote . AbstractProtocol$AbstractConnectionHandler . process ( AbstractProtocol . java : 515 )
at org . apache . tomcat . util . net . JIoEndpoint$SocketProcessor . run ( JIoEndpoint . java : 304 )
at java . util . concurrent . ThreadPoolExecutor$Worker . runTask ( ThreadPoolExecutor . java : 886 )
at java . util . concurrent . ThreadPoolExecutor$Worker . run ( ThreadPoolExecutor . java : 908 )
at java . lang . Thread . run ( Thread . java : 662 )
Caused by : javax . faces . el . EvaluationException : javax . el . PropertyNotFoundException : / index . xhtml @13 , 78 action = "#{Testando.testando}" : Target Unreachable , identifier ' Testando ' resolved to null
at javax . faces . component . MethodBindingMethodExpressionAdapter . invoke ( MethodBindingMethodExpressionAdapter . java : 95 )
at com . sun . faces . application . ActionListenerImpl . processAction ( ActionListenerImpl . java : 102 )
... 23 more
Caused by : javax . el . PropertyNotFoundException : / index . xhtml @13 , 78 action = "#{Testando.testando}" : Target Unreachable , identifier ' Testando ' resolved to null
at com . sun . faces . facelets . el . TagMethodExpression . invoke ( TagMethodExpression . java : 107 )
at javax . faces . component . MethodBindingMethodExpressionAdapter . invoke ( MethodBindingMethodExpressionAdapter . java : 88 )
... 24 more
lsjunior 19 de out. de 2011
Agora é que seu managedbean não foi encontrado. Vc está anotando eles com @ManagedBean e colocando o nome neles?
brunobuild 19 de out. de 2011
Encontrei uma coisa no meu java build path que não sei o que é, ele está excluindo os meus arquivos *.java
Segue imagem.
o meu managedBean
import javax.faces.bean.ManagedBean ;
import javax.faces.bean.RequestScoped ;
@ManagedBean ( name = "Testando" )
@RequestScoped
public class TestandoFacade
{
public void testando ()
{
System . out . println ( "Testando Bruno Rodrigues e Rodrigues" );
}
}
Meu arquivo xhtml
& lt ;! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" & gt ;
& lt ; html xmlns = "http://www.w3.org/1999/xhtml"
xmlns : h = "http://java.sun.com/jsf/html"
xmlns : f = "http://java.sun.com/jsf/core"
xmlns : ui = "http://java.sun.com/jsf/facelets"
xmlns : p = "http://primefaces.prime.com.tr/ui" & gt ;
& lt ; h : head & gt ;
& lt ;/ h : head & gt ;
& lt ; h : body & gt ;
& lt ; h : form & gt ;
& lt ; p : commandButton value = "Testando o Maven" action = "#{Testando.testando}" /& gt ;
& lt ;/ h : form & gt ;
& lt ;/ h : body & gt ;
& lt ;/ html & gt ;