3 Replies Latest reply on Dec 6, 2012 2:42 PM by numerico

    seam 3.1 dependencies problem?

    kgoedert

      Hi,

       

      I am using maven 3.0.3 to create a seam 3.1 project. The pom is as follows:

       

      <?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>sample</groupId>

                <artifactId>sample</artifactId>

                <version>0.0.1-SNAPSHOT</version>

                <packaging>war</packaging>

       

       

                <name>sample</name>

       

       

                <properties>

                          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

                          <arquillian.version>1.0.0.CR7</arquillian.version>

                          <jboss-javaee6-spec.version>1.0.0.Final</jboss-javaee6-spec.version>

                          <version.arquillian_persistence>1.0.0.Alpha3</version.arquillian_persistence>

                          <jacoco.version>0.5.3.201107060350</jacoco.version>

                          <arquillian.jacoco.version>1.0.0.Alpha2</arquillian.jacoco.version>

                          <jndi>${provider.url}</jndi>

                          <seam.version>3.1.0.Final</seam.version>

                </properties>

       

       

                <profiles>

                          <profile>

                                    <id>jbossas-remote-6</id>

                                    <dependencies>

                                              <dependency>

                                                        <groupId>org.jboss.arquillian.container</groupId>

                                                        <artifactId>arquillian-jbossas-remote-6</artifactId>

                                                        <version>1.0.0.CR2</version>

                                              </dependency>

                                              <dependency>

                                                        <groupId>org.jboss.jbossas</groupId>

                                                        <artifactId>jboss-as-client</artifactId>

                                                        <version>6.1.0.Final</version>

                                                        <type>pom</type>

                                              </dependency>

                                    </dependencies>

                                    <build>

                                              <plugins>

                                                        <plugin>

                                                                  <artifactId>maven-surefire-plugin</artifactId>

                                                                  <executions>

                                                                            <execution>

                                                                                      <id>surefire-itest</id>

                                                                                      <phase>test</phase>

                                                                                      <goals>

                                                                                                <goal>test</goal>

                                                                                      </goals>

                                                                                      <configuration>

                                                                                                <excludes>

                                                                                                          <exclude>none</exclude>

                                                                                                </excludes>

                                                                                      </configuration>

                                                                            </execution>

                                                                  </executions>

                                                        </plugin>

                                              </plugins>

                                              <testResources>

                                                        <testResource>

                                                                  <directory>src/test/resources</directory>

                                                        </testResource>

                                                        <testResource>

                                                                  <directory>src/test/resources-jbossas-remote</directory>

                                                        </testResource>

                                              </testResources>

                                    </build>

                          </profile>

                </profiles>

       

       

                <dependencyManagement>

                          <dependencies>

                                    <dependency>

                                              <groupId>org.jboss.arquillian</groupId>

                                              <artifactId>arquillian-bom</artifactId>

                                              <version>1.0.0.CR7</version>

                                              <type>pom</type>

                                              <scope>import</scope>

                                    </dependency>

                                    <dependency>

                                              <groupId>org.jboss.spec</groupId>

                                              <artifactId>jboss-javaee-6.0</artifactId>

                                              <version>2.0.0.Final</version>

                                              <type>pom</type>

                                              <scope>import</scope>

                                    </dependency>

                                    <dependency>

                                              <groupId>org.hibernate</groupId>

                                              <artifactId>hibernate-entitymanager</artifactId>

                                              <version>3.6.6.Final</version>

                                              <scope>provided</scope>

                                    </dependency>

                                    <dependency>

                                              <groupId>org.jboss.seam</groupId>

                                              <artifactId>seam-bom</artifactId>

                                              <version>${seam.version}</version>

                                              <scope>import</scope>

                                              <type>pom</type>

                                    </dependency>

                          </dependencies>

                </dependencyManagement>

       

       

                <dependencies>

                          <dependency>

                                    <groupId>org.hibernate</groupId>

                                    <artifactId>hibernate-validator</artifactId>

                                    <type>jar</type>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.hibernate.javax.persistence</groupId>

                                    <artifactId>hibernate-jpa-2.0-api</artifactId>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.spec.javax.ejb</groupId>

                                    <artifactId>jboss-ejb-api_3.1_spec</artifactId>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.spec.javax.transaction</groupId>

                                    <artifactId>jboss-transaction-api_1.1_spec</artifactId>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>javax.enterprise</groupId>

                                    <artifactId>cdi-api</artifactId>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.spec.javax.annotation</groupId>

                                    <artifactId>jboss-annotations-api_1.1_spec</artifactId>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.spec.javax.servlet</groupId>

                                    <artifactId>jboss-servlet-api_3.0_spec</artifactId>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.spec.javax.faces</groupId>

                                    <artifactId>jboss-jsf-api_2.0_spec</artifactId>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.hibernate</groupId>

                                    <artifactId>hibernate-entitymanager</artifactId>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.primefaces</groupId>

                                    <artifactId>primefaces</artifactId>

                                    <version>3.2</version>

                          </dependency>

                          <dependency>

                                    <groupId>org.glassfish</groupId>

                                    <artifactId>javax.faces</artifactId>

                                    <version>2.1.6</version>

                          </dependency>

                          <dependency>

                                    <groupId>junit</groupId>

                                    <artifactId>junit</artifactId>

                                    <version>4.8.2</version>

                                    <scope>test</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.arquillian.junit</groupId>

                                    <artifactId>arquillian-junit-container</artifactId>

                                    <scope>test</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.arquillian.extension</groupId>

                                    <artifactId>arquillian-persistence-api</artifactId>

                                    <version>${version.arquillian_persistence}</version>

                                    <scope>test</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.arquillian.extension</groupId>

                                    <artifactId>arquillian-persistence-impl</artifactId>

                                    <version>${version.arquillian_persistence}</version>

                                    <scope>test</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.hamcrest</groupId>

                                    <artifactId>hamcrest-all</artifactId>

                                    <version>1.1</version>

                                    <scope>test</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.arquillian.protocol</groupId>

                                    <artifactId>arquillian-protocol-servlet</artifactId>

                                    <scope>test</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.arquillian.extension</groupId>

                                    <artifactId>arquillian-jacoco</artifactId>

                                    <scope>test</scope>

                                    <version>${arquillian.jacoco.version}</version>

                          </dependency>

                          <dependency>

                                    <groupId>org.jacoco</groupId>

                                    <artifactId>org.jacoco.core</artifactId>

                                    <version>${jacoco.version}</version>

                                    <scope>test</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.mockito</groupId>

                                    <artifactId>mockito-all</artifactId>

                                    <version>1.9.0</version>

                                    <scope>test</scope>

                          </dependency>

                          <dependency>

                                    <groupId>commons-beanutils</groupId>

                                    <artifactId>commons-beanutils</artifactId>

                                    <version>1.8.3</version>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.seam.faces</groupId>

                                    <artifactId>seam-faces</artifactId>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.seam.faces</groupId>

                                    <artifactId>seam-faces-api</artifactId>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.seam.international</groupId>

                                    <artifactId>seam-international</artifactId>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.spec.javax.el</groupId>

                                    <artifactId>jboss-el-api_2.2_spec</artifactId>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>pmd</groupId>

                                    <artifactId>pmd</artifactId>

                                    <version>4.2.5</version>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>jaxen</groupId>

                                    <artifactId>jaxen</artifactId>

                                    <version>1.1.1</version>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>asm</groupId>

                                    <artifactId>asm</artifactId>

                                    <version>3.1</version>

                                    <scope>provided</scope>

                          </dependency>

                          <dependency>

                                    <groupId>org.jboss.seam.security</groupId>

                                    <artifactId>seam-security-api</artifactId>

                          </dependency>

       

       

                          <dependency>

                                    <groupId>org.jboss.seam.security</groupId>

                                    <artifactId>seam-security</artifactId>

                                    <scope>runtime</scope>

                          </dependency>

                          <dependency>

                                    <groupId>commons-codec</groupId>

                                    <artifactId>commons-codec</artifactId>

                                    <version>1.6</version>

                          </dependency>

                </dependencies>

       

       

                <pluginRepositories>

                          <pluginRepository>

                                    <id>JBoss Repo</id>

                                    <url>https://repository.jboss.org/nexus/content/repositories/releases</url>

                                    <name>JBoss Repo</name>

                          </pluginRepository>

                </pluginRepositories>

       

       

                <repositories>

                          <repository>

                                    <id>JBOSS_NEXUS</id>

                                    <url>http://repository.jboss.org/nexus/content/groups/public</url>

                          </repository>

                          <repository>

                                    <id>maven-nuxeo</id>

                                    <name>Maven Nuxeo Repository</name>

                                    <url>https://maven.nuxeo.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>

                          <repository>

                                    <id>Prime Technology Maven Repository</id>

                                    <url>http://repository.primefaces.org</url>

                          </repository>

                </repositories>

       

       

                <build>

                          <finalName>sample</finalName>

                          <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>

                                                        <debug>true</debug>

                                              </configuration>

                                    </plugin>

                                    <plugin>

                                              <groupId>org.apache.maven.plugins</groupId>

                                              <artifactId>maven-war-plugin</artifactId>

                                              <extensions>false</extensions>

                                              <version>2.1.1</version>

                                              <configuration>

                                                        <failOnMissingWebXml>false</failOnMissingWebXml>

                                              </configuration>

                                    </plugin>

                                    <plugin>

                                              <groupId>com.google.code.maven-replacer-plugin</groupId>

                                              <artifactId>maven-replacer-plugin</artifactId>

                                              <version>1.4.1</version>

                                              <executions>

                                                        <execution>

                                                                  <phase>process-test-resources</phase>

                                                                  <goals>

                                                                            <goal>replace</goal>

                                                                  </goals>

                                                        </execution>

                                              </executions>

                                              <configuration>

                                                        <file>target/test-classes/arquillian.xml</file>

                                                        <replacements>

                                                                  <replacement>

                                                                            <token>jndi.port</token>

                                                                            <value>${provider.url}</value>

                                                                  </replacement>

                                                        </replacements>

                                              </configuration>

                                    </plugin>

                                    <plugin>

                                              <groupId>org.jacoco</groupId>

                                              <artifactId>jacoco-maven-plugin</artifactId>

                                              <version>0.5.5.201112152213</version>

                                              <configuration>

                                                        <destfile>${basedir}/target/coverage-reports/jacoco-unit.exec</destfile>

                                                        <datafile>${basedir}/target/coverage-reports/jacoco-unit.exec</datafile>

                                              </configuration>

                                              <executions>

                                                        <execution>

                                                                  <id>jacoco-initialize</id>

                                                                  <goals>

                                                                            <goal>prepare-agent</goal>

                                                                  </goals>

                                                        </execution>

                                                        <execution>

                                                                  <id>jacoco-site</id>

                                                                  <phase>package</phase>

                                                                  <goals>

                                                                            <goal>report</goal>

                                                                  </goals>

                                                        </execution>

                                              </executions>

                                    </plugin>

                                    <plugin>

                                              <groupId>org.codehaus.mojo</groupId>

                                              <artifactId>findbugs-maven-plugin</artifactId>

                                              <version>2.4.0</version>

                                              <configuration>

                                                        <findbugsXmlOutput>true</findbugsXmlOutput>

                                                        <!-- Optional directory to put findbugs xml report -->

                                                        <findbugsXmlOutputDirectory>target/site/findbugs</findbugsXmlOutputDirectory>

                                              </configuration>

                                              <executions>

                                                        <execution>

                                                                  <id>findbugs-report</id>

                                                                  <phase>package</phase>

                                                                  <goals>

                                                                            <goal>findbugs</goal>

                                                                  </goals>

                                                        </execution>

                                              </executions>

                                    </plugin>

                                    <plugin>

                                              <groupId>org.apache.maven.plugins</groupId>

                                              <artifactId>maven-surefire-plugin</artifactId>

                                              <version>2.12</version>

                                              <configuration>

                                                        <excludes>

                                                                  <exclude>**/*ITTest*.java</exclude>

                                                        </excludes>

                                              </configuration>

                                    </plugin>

                          </plugins>

                          <pluginManagement>

                                    <plugins>

                                              <!--This plugin's configuration is used to store Eclipse m2e settings

                                                        only. It has no influence on the Maven build itself. Na verdade serve pro

                                                        eclipse nao ficar apontando erro onde nao tem nada de errado -->

                                              <plugin>

                                                        <groupId>org.eclipse.m2e</groupId>

                                                        <artifactId>lifecycle-mapping</artifactId>

                                                        <version>1.0.0</version>

                                                        <configuration>

                                                                  <lifecycleMappingMetadata>

                                                                            <pluginExecutions>

                                                                                      <pluginExecution>

                                                                                                <pluginExecutionFilter>

                                                                                                          <groupId>

                                                                                                                    com.google.code.maven-replacer-plugin

                                                                                                          </groupId>

                                                                                                          <artifactId>

                                                                                                                    maven-replacer-plugin

                                                                                                          </artifactId>

                                                                                                          <versionRange>

                                                                                                                    [1.4.1,)

                                                                                                          </versionRange>

                                                                                                          <goals>

                                                                                                                    <goal>replace</goal>

                                                                                                          </goals>

                                                                                                </pluginExecutionFilter>

                                                                                                <action>

                                                                                                          <ignore></ignore>

                                                                                                </action>

                                                                                      </pluginExecution>

                                                                                      <pluginExecution>

                                                                                                <pluginExecutionFilter>

                                                                                                          <groupId>org.jacoco</groupId>

                                                                                                          <artifactId>

                                                                                                                    jacoco-maven-plugin

                                                                                                          </artifactId>

                                                                                                          <versionRange>

                                                                                                                    [0.5.5.201112152213,)

                                                                                                          </versionRange>

                                                                                                          <goals>

                                                                                                                    <goal>prepare-agent</goal>

                                                                                                          </goals>

                                                                                                </pluginExecutionFilter>

                                                                                                <action>

                                                                                                          <ignore></ignore>

                                                                                                </action>

                                                                                      </pluginExecution>

                                                                            </pluginExecutions>

                                                                  </lifecycleMappingMetadata>

                                                        </configuration>

                                              </plugin>

                                    </plugins>

                          </pluginManagement>

                </build>

      </project>

       

       

      In eclipse the project compiles just fine. I can deploy using jboss tools. Everything works. But if I try to compile the same project using maven on the command line I get a compilation error for my authenticator class. The error is this:

       

      Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project sample: Compilation failure: Compilation failure:

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[14,30] cannot find symbol

      [ERROR] symbol  : class BaseAuthenticator

      [ERROR] location: package org.jboss.seam.security

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[17,34] package org.picketlink.idm.impl.api does not exist

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[18,40] package org.picketlink.idm.impl.api.model does not exist

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[25,39] cannot find symbol

      [ERROR] symbol: class BaseAuthenticator

      [ERROR] public class AuthenticatorBean extends BaseAuthenticator implements Authenticator {

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[14,30] cannot find symbol

      [ERROR] symbol  : class BaseAuthenticator

      [ERROR] location: package org.jboss.seam.security

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[17,34] package org.picketlink.idm.impl.api does not exist

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[18,40] package org.picketlink.idm.impl.api.model does not exist

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[25,39] cannot find symbol

      [ERROR] symbol: class BaseAuthenticator

      [ERROR] public class AuthenticatorBean extends BaseAuthenticator implements Authenticator {

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[25,7] com.sample.view.AuthenticatorBean is not abstract and does not override abstract method getStatus() in org.jboss.seam.security.Authenticator

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[38,9] cannot find symbol

      [ERROR] symbol  : class PasswordCredential

      [ERROR] location: class com.sample.view.AuthenticatorBean

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[38,38] cannot find symbol

      [ERROR] symbol  : class PasswordCredential

      [ERROR] location: class com.sample.view.AuthenticatorBean

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[55,15] cannot find symbol

      [ERROR] symbol  : class SimpleUser

      [ERROR] location: class com.sample.view.AuthenticatorBean

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[56,3] cannot find symbol

      [ERROR] symbol  : method setStatus(org.jboss.seam.security.Authenticator.AuthenticationStatus)

      [ERROR] location: class com.sample.view.AuthenticatorBean

      [ERROR] /home/kelly/newwksp/sample/src/main/java/com/sample/view/AuthenticatorBean.java:[58,3] cannot find symbol

      [ERROR] symbol  : method setStatus(org.jboss.seam.security.Authenticator.AuthenticationStatus)

      [ERROR] location: class com.sample.view.AuthenticatorBean

      [ERROR] -> [Help 1]

      [ERROR]

      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

      [ERROR] Re-run Maven using the -X switch to enable full debug logging.

       

      and the AuthenticatorBean as follows:

       

      {code}

      package com.sample.view;

       

       

      import java.security.MessageDigest;

      import java.security.NoSuchAlgorithmException;

      import java.util.Set;

       

       

      import javax.ejb.EJB;

      import javax.faces.application.FacesMessage;

      import javax.faces.context.FacesContext;

      import javax.inject.Inject;

       

       

      import org.apache.commons.codec.binary.Hex;

      import org.jboss.seam.security.Authenticator;

      import org.jboss.seam.security.BaseAuthenticator;

      import org.jboss.seam.security.Credentials;

      import org.jboss.seam.security.Identity;

      import org.picketlink.idm.impl.api.PasswordCredential;

      import org.picketlink.idm.impl.api.model.SimpleUser;

       

       

      import com.sample.business.AuthenticationManagerLocal;

      import com.sample.domain.Role;

      import com.sample.domain.User;

      import com.sample.utils.MessageUtils;

       

       

      public class AuthenticatorBean extends BaseAuthenticator implements Authenticator {

                @Inject

                private Identity identity;

                @Inject

                private Credentials credentials;

                @EJB

                private AuthenticationManagerLocal authenticator;

                @Inject

                private FacesContext context;

       

       

                @Override

                public void authenticate() {

                          try {

                                    final PasswordCredential passwd = (PasswordCredential) credentials.getCredential();

                                    final MessageDigest messageDigest = MessageDigest.getInstance("MD5");

                                    messageDigest.update(passwd.getValue().getBytes());

       

       

                                    final String hexString = new String(Hex.encodeHex(messageDigest.digest()));

       

       

                                    User user = new User();

                                    user.setName(credentials.getUsername());

                                    user.setPassword(hexString);

       

       

                                    user = authenticator.checkCredentials(user);

       

       

                                    identity.addGroup("USERS", "GROUP");

                                    final Set<Role> roles = user.getRoles();

                                    for (final Role role : roles) {

                                              identity.addRole(role.getName().toString(), "USERS", "GROUP");

                                    }

                                    setUser(new SimpleUser(credentials.getUsername()));

                                    setStatus(AuthenticationStatus.SUCCESS);

                          } catch (final NoSuchAlgorithmException e) {

                                    setStatus(AuthenticationStatus.FAILURE);

                                    context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, MessageUtils.getMessage(context.getViewRoot().getLocale(), "invalid.login"), null));

                          }

                }

      }

      {code}

       

      What am I missing on my pom.xml that makes the project not compile in the command line, but compile in eclipse?

       

      Thanks for any help.

       

      Kelly

        • 1. Re: seam 3.1 dependencies problem?
          zeeman

          Use Seam BOM to manage Seam dependencies. Be sure to use the probper scope. Look at examples POMs like booking or security ones

          https://github.com/seam/examples

          • 2. Re: seam 3.1 dependencies problem?
            pyb

            Change

             

              <dependency>

                                          <groupId>org.jboss.seam.security</groupId>

                                          <artifactId>seam-security</artifactId>

                                          <scope>runtime</scope>

                                </dependency>

             

             

             

            To

             

              <dependency>

                                          <groupId>org.jboss.seam.security</groupId>

                                          <artifactId>seam-security</artifactId>

                                          <scope>compile</scope>

                                </dependency>

            • 3. Re: seam 3.1 dependencies problem?
              numerico

              That did work for me. Can't find why are seam-security and seam-faces supposed to be runtime scoped...