[jboss-user] [JBoss Seam] - Re: Seam 2.0.0.0GA + Maven2 doesn`t work...

w17chm4n do-not-reply at jboss.com
Tue Nov 13 05:29:06 EST 2007


I`ve managed to deal with building Seam 2.0 application without exclusions.

main project 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/maven-v4_0_0.xsd">
  |   <modelVersion>4.0.0</modelVersion>
  |   <groupId>com.blstream.inquisitor</groupId>
  |   <artifactId>Inquisitor</artifactId>
  |   <packaging>pom</packaging>
  |   <version>1.0-SNAPSHOT</version>
  |   <name>Inquisitor</name>
  |   <repositories>
  |     <repository>
  |       <id>JBossMaven2Repository</id>
  |       <name>JBoss Maven2 Repository</name>
  |       <url>http://repository.jboss.com/maven2</url>
  |     </repository>
  |   </repositories>
  |   <dependencyManagement>
  |     <dependencies>
  |       <dependency>
  | 	<groupId>org.jboss.seam</groupId>
  | 	<artifactId>jboss-seam</artifactId>
  | 	<version>2.0.0.GA</version>
  |       </dependency>
  |     </dependencies>
  |   </dependencyManagement>
  |   <build>
  |     <plugins>
  |       <plugin>
  | 	<artifactId>maven-compiler-plugin</artifactId>
  | 	<configuration>
  | 	  <fileName>ear/target/Inquisitor.ear</fileName>
  | 	  <source>1.5</source>
  | 	  <target>1.5</target>
  | 	</configuration>
  |       </plugin>
  |     </plugins>
  |   </build>
  |   <modules>
  |     <module>webapp</module>
  |     <module>ejb3</module>
  |     <module>ear</module>
  |   </modules>
  | </project>
  | 

war

  | <?xml version="1.0"?><project>
  |     <parent>
  |         <artifactId>Inquisitor</artifactId>
  |         <groupId>com.blstream.inquisitor</groupId>
  |         <version>1.0-SNAPSHOT</version>
  |     </parent>
  |     <modelVersion>4.0.0</modelVersion>
  |     <groupId>com.blstream.inquisitor</groupId>
  |     <artifactId>webapp</artifactId>
  |     <packaging>war</packaging>
  |     <name>Inquisitor::${artifactId}</name>
  |     <version>${pom.parent.version}</version>
  |     <build>
  |         <finalName>webapp</finalName>
  |     </build>
  |     <repositories>
  |         <repository>
  |             <id>JBossMaven2Repository</id>
  |             <name>JBoss Maven2 Repository</name>
  |             <url>http://repository.jboss.com/maven2</url>
  |         </repository>
  |     </repositories>
  |     <dependencies>
  |         <dependency>
  |             <groupId>junit</groupId>
  |             <artifactId>junit</artifactId>
  |             <version>3.8.1</version>
  |             <scope>test</scope>
  |         </dependency>
  |         <dependency>
  |             <groupId>org.jboss.seam</groupId>
  |             <artifactId>jboss-seam-debug</artifactId>
  |             <version>2.0.0.GA</version>
  |         </dependency>
  |         <dependency>
  |             <groupId>org.jboss.seam</groupId>
  |             <artifactId>jboss-seam-ui</artifactId>
  |             <version>2.0.0.GA</version>
  |         </dependency>
  |         <dependency>
  |             <groupId>org.jboss.seam</groupId>
  |             <artifactId>jboss-el</artifactId>
  |             <version>2.0.0.GA</version>
  |             <scope>provided</scope>
  |         </dependency>
  |         <dependency>
  |             <groupId>javax.el</groupId>
  |             <artifactId>el-api</artifactId>
  |             <version>1.0</version>
  |             <scope>provided</scope>
  |         </dependency>
  |         <dependency>
  |             <groupId>javax.faces</groupId>
  |             <artifactId>jsf-api</artifactId>
  |             <version>1.2_04-p02</version>
  |             <scope>provided</scope>
  |         </dependency>        
  |     </dependencies>
  | </project>
  | 

EJB

  | <?xml version="1.0"?><project>
  |     <parent>
  |         <artifactId>Inquisitor</artifactId>
  |         <groupId>com.blstream.inquisitor</groupId>
  |         <version>1.0-SNAPSHOT</version>
  |     </parent>
  |     <modelVersion>4.0.0</modelVersion>
  |     <groupId>com.blstream.inquisitor</groupId>
  |     <artifactId>ejb3</artifactId>
  |     <packaging>ejb</packaging>
  |     <name>Inquisitor::${artifactId}</name>
  |     <version>${pom.parent.version}</version>
  |     <repositories>
  |         <repository>
  |             <id>JBossMaven2Repository</id>
  |             <name>JBoss Maven2 Repository</name>
  |             <url>http://repository.jboss.com/maven2</url>
  |         </repository>
  |     </repositories>
  |     <build>
  |         <finalName>ejb3</finalName>
  |     </build>
  |     <modules>
  |         <javaModule>jboss-seam-2.0.0.GA</javaModule>
  |         <javaModule>jboss-el-2.0.0.GA</javaModule>
  |     </modules>
  |     <dependencies>
  |         <dependency>
  |             <groupId>junit</groupId>
  |             <artifactId>junit</artifactId>
  |             <version>3.8.1</version>
  |             <scope>test</scope>
  |         </dependency>
  |         <dependency>
  |             <groupId>org.jboss.seam</groupId>
  |             <artifactId>jboss-seam</artifactId>
  |         </dependency>
  |         <dependency>
  |             <groupId>org.jboss.javaee</groupId>
  |             <artifactId>jboss-ejb-api</artifactId>
  |             <version>3.0.0.20070913080910</version>
  |         </dependency>
  |         <dependency>
  |             <groupId>javax.persistence</groupId>
  |             <artifactId>persistence-api</artifactId>
  |             <version>1.0</version>
  |         </dependency>
  |         <dependency>
  |             <groupId>org.hibernate</groupId>
  |             <artifactId>hibernate-validator</artifactId>
  |             <version>3.0.0.GA</version>
  |         </dependency>
  |     </dependencies>
  | </project>
  | 

EAR

  | <?xml version="1.0"?><project>
  |     <parent>
  |         <artifactId>Inquisitor</artifactId>
  |         <groupId>com.blstream.inquisitor</groupId>
  |         <version>1.0-SNAPSHOT</version>
  |     </parent>
  |     <modelVersion>4.0.0</modelVersion>
  |     <groupId>com.blstream.inquisitor</groupId>
  |     <artifactId>ear</artifactId>
  |     <packaging>ear</packaging>
  |     <name>Inquisitor::${artifactId}</name>
  |     <version>${pom.parent.version}</version>
  |     <dependencies>
  |         <dependency>
  |             <groupId>junit</groupId>
  |             <artifactId>junit</artifactId>
  |             <version>3.8.1</version>
  |             <scope>test</scope>
  |         </dependency>
  |         <dependency>
  |             <groupId>com.blstream.inquisitor</groupId>
  |             <artifactId>ejb3</artifactId>
  |             <version>${pom.parent.version}</version>
  |             <type>ejb</type>
  |         </dependency>
  |         <dependency>
  |             <groupId>com.blstream.inquisitor</groupId>
  |             <artifactId>webapp</artifactId>
  |             <version>${pom.parent.version}</version>
  |             <type>war</type>
  |         </dependency>
  |     </dependencies>
  |     <build>
  |         <plugins>
  |             <plugin>
  |                 <artifactId>maven-ear-plugin</artifactId>
  |                 <configuration>
  |                     <modules>
  |                         <ejbModule>
  |                             <groupId>com.blstream.inquisitor</groupId>
  |                             <artifactId>ejb3</artifactId>
  |                         </ejbModule>
  |                         <javaModule>
  |                             <groupId>org.jboss.seam</groupId>
  |                             <artifactId>jboss-seam</artifactId>
  |                             <includeInApplicationXml>true</includeInApplicationXml>
  |                         </javaModule>
  |                         <javaModule>
  |                             <groupId>org.jboss.seam</groupId>
  |                             <artifactId>jboss-el</artifactId>
  |                             <includeInApplicationXml>true</includeInApplicationXml>
  |                         </javaModule>
  |                         <webModule>
  |                             <groupId>com.blstream.inquisitor</groupId>
  |                             <artifactId>webapp</artifactId>
  |                             <contextRoot>inquisitor</contextRoot>
  |                         </webModule>
  |                     </modules>
  |                 </configuration>
  |             </plugin>
  |         </plugins>
  |         <finalName>Inquisitor</finalName>
  |     </build>
  | </project>
  | 


So now application builds and deploys smoothly but I`ve encountered another problem. There are no seam components which I`ve created in ANY scope.

Example:

questioncategory.xml

  | <html xmlns="http://www.w3.org/1999/xhtml"
  |       xmlns:ui="http://java.sun.com/jsf/facelets"
  |       xmlns:h="http://java.sun.com/jsf/html"
  |       xmlns:f="http://java.sun.com/jsf/core"
  |       xmlns:s="http://jboss.com/products/seam/taglib">
  |     <body>
  |         
  |         <h:form>
  |             <h:inputText value="#{QuestionCategory.categoryName}" required="true"/>
  |             <h:outputText value="categoryList is null" rendered="#{questionCategoryList == null}"/><br/>
  |             <h:outputText value="categoryList rowCount = 0" rendered="#{questionCategoryList.size == 0}"/><br/>
  |             <h:outputText value="Available categoryList: " rendered="#{questionCategoryList.size > 0}"/><br/>
  |             <h:commandButton type="submit" value="Add new category" action="#{QuestionCategoryController.addCategory}"/><br/>
  |             <h:dataTable var="cat" value="#{questionCategoryList}">
  |                 <h:column>
  |                     <h:outputText value="[ #{cat.categoryName} ]"/>
  |                 </h:column>
  |                 <h:column>
  |                     <h:outputText value=" - [ #{cat.created} ]"><s:convertDateTime pattern="MM/dd/yyyy"/></h:outputText>
  |                 </h:column>
  |                 <h:column>
  |                     <s:link value="remove" action="#{QuestionCategoryController.removeCategory}"/>
  |                 </h:column>
  |                 <h:column>
  |                     <s:link value="select" action="#{QuestionCategoryController.selectCategory(cat)}"/>
  |                 </h:column>
  |             </h:dataTable>
  |         </h:form>
  |         
  |         <ui:debug hotkey="d"/>
  |         
  |     </body>
  | </html>
  | 

QuestionCategoryController

  | @Stateful
  | @Scope(ScopeType.SESSION)
  | @Name("QuestionCategoryController")
  | public class QuestionCategoryControllerBean implements QuestionCategoryController {
  |     
  |     @Logger
  |     private Log log;
  |     
  |     @In(create = true)
  |     private QuestionCategoryManager questionCategoryManager;
  |     
  |     @DataModel
  |     private List<QuestionCategory> questionCategoryList;    
  |     
  |     @In(create = true)
  |     @DataModelSelection
  |     private QuestionCategory questionCategory;
  |     
  |     public void addCategory() {
  |         log.info("Adding category [#{questionCategory.categoryName}]");
  |         questionCategoryManager.addCategory(questionCategory);
  |         getAllQuestionsCategories();
  |     }
  |     
  |     public void removeCategory() {
  |         questionCategoryList.remove(questionCategory);
  |         questionCategoryManager.removeCategory(questionCategory);
  |         questionCategory = null;
  |         getAllQuestionsCategories();
  |     }
  |     
  |     public void selectCategory(QuestionCategory category) {
  |         questionCategory = category;
  |     }
  |     
  |     @Factory(value="questionCategoryList")
  |     public void getAllQuestionsCategories() {
  |         questionCategoryList = questionCategoryManager.getAllQuestionCategories();
  |     }
  |     
  |     @Remove @Destroy
  |     public void destroy() {}
  |     
  | }
  | 

QuestionCategory entity

  | @Entity
  | @Scope(ScopeType.EVENT)
  | @Name("questionCategory")
  | @Table(name="QuestionCategories")
  | public class QuestionCategory implements Serializable {
  |     
  |     @Id @GeneratedValue
  |     private Long id;
  |     
  |     @NotNull @Length(min=3, max=100)
  |     private String categoryName;
  |     
  |     @OneToMany
  |     private List<Question> questionList;
  |     
  |     @Temporal(value = TemporalType.TIMESTAMP)
  |     private Date created;
  |     
  |     @Override
  |     public boolean equals(Object obj) {
  |         if (!(obj instanceof QuestionCategory) || this.id == null) {
  |             return false;
  |         }
  |         
  |         return this.id.equals(((QuestionCategory)obj).getId());
  |     }
  |     
  |     public QuestionCategory() {
  |         this.questionList = new ArrayList<Question>();
  |     }
  |     
  |     public QuestionCategory(String categoryName) {
  |         this.categoryName = categoryName;
  |         this.questionList = new ArrayList<Question>();
  |     }
  |     
  |     public Long getId() {
  |         return id;
  |     }
  |     
  |     public void setId(Long id) {
  |         this.id = id;
  |     }
  |     
  |     public String getCategoryName() {
  |         return categoryName;
  |     }
  |     
  |     public void setCategoryName(String categoryName) {
  |         this.categoryName = categoryName;
  |     }
  |     
  |     public List<Question> getQuestionList() {
  |         return questionList;
  |     }
  |     
  |     public void setQuestionList(List<Question> questionList) {
  |         this.questionList = questionList;
  |     }
  |     
  |     public Date getCreated() {
  |         return created;
  |     }
  |     
  |     public void setCreated(Date created) {
  |         this.created = created;
  |     }
  | }
  | 

...I don`t have to say that this code works on Seam 1.2.1 -_- ? 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104003#4104003

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104003



More information about the jboss-user mailing list