Monday, May 26, 2014

Java EE 109 Maven Dependencies

---
Java EE 109 Maven Dependencies
This tutorial is based on http://www.youtube.com/watch?v=PM-f8ROIhTU 
STEPS
1) Run Eclipse.
2) Open “J2eeapplication” Project.
3) Add New Maven Dependency item.
4) Troubleshooting Dependency Problem.

STEPS

1) Run Eclipse.

2) Open “J2eeapplication” Project.

3) Add New Maven Dependency item.

3.1) Right-click project name, select Mave/Add Dependency.
3.2) Type “hibernate-core”
Select 4.1.8-Final[jar]
3.3) Outcome:
3.3) Add Dependency “hibernate-validator”.
Select 4.2.0.Final[jar]
3.4) Outcome:
3.5) Manual Entry.
<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.0http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example.j2eeapp</groupId>
  <artifactId>j2eeapplication</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>J2EE Applications Example</name>
  <dependencies>
          <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-core</artifactId>
                  <version>4.1.8.Final</version>
          </dependency>
          <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-validator</artifactId>
                  <version>4.2.0.Final</version>
          </dependency>
          <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.8.2</version>
                  <scope>test</scope>
          </dependency>
          <dependency>
                  <groupId>org.springframework.webflow</groupId>
                  <artifactId>spring-webflow</artifactId>
                  <version>2.3.0.RELEASE</version>
          </dependency>
          <dependency>
                  <groupId>org.springframework.webflow</groupId>
                  <artifactId>spring-faces</artifactId>
                  <version>2.3.0.RELEASE</version>
          </dependency>
          <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-orm</artifactId>
                  <version>3.1.1</version>
          </dependency>
          <dependency>
                  <groupId>com.oracle</groupId>
                  <artifactId>ojdbc14</artifactId>
                  <version>10.2.0.1.0</version>
          </dependency>
          <dependency>
                  <groupId>log4j</groupId>
                  <artifactId>log4j</artifactId>
                  <version>1.2.16</version>
          </dependency>
          <dependency>
                  <groupId>com.sun.faces</groupId>
                  <artifactId>jsf-impl</artifactId>
                  <version>2.1.10</version>
          </dependency>
          <dependency>
                  <groupId>com.sun.facelets</groupId>
                  <artifactId>jsf-facelets</artifactId>
                  <version>1.1.14</version>
          </dependency>
          <dependency>
                  <groupId>com.sun.faces</groupId>
                  <artifactId>jsf-api</artifactId>
                  <version>2.1.10</version>
          </dependency>
          <dependency>
                  <groupId>commons-dbcp</groupId>
                  <artifactId>commons-dbcp</artifactId>
                  <version>20030825.184428</version>
          </dependency>
          <dependency>
                  <groupId>javax.servlet</groupId>
                  <artifactId>slf4j-log4j12</artifactId>
                  <version>1.6.4</version>
          </dependency>
          <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-tx</artifactId>
                  <version>3.0.5.RELEASE</version>
          </dependency>
          <dependency>
                  <groupId>xml-apis</groupId>
                  <artifactId>xml-apis</artifactId>
                  <version>1.3.02</version>
          </dependency>
          <dependency>
                  <groupId>org.springframework.security</groupId>
                  <artifactId>spring-security-web</artifactId>
                  <version>3.1.0.RELEASE</version>
          </dependency>
          <dependency>
                  <groupId>org.springframework.security</groupId>
                  <artifactId>spring-security-config</artifactId>
                  <version>3.1.0.RELEASE</version>
          </dependency>
          <dependency>
                  <groupId>org.primefaces</groupId>
                  <artifactId>primefaces</artifactId>
                  <version>3.4</version>
          </dependency>
          <dependency>
                  <groupId>cglib</groupId>
                  <artifactId>cglib</artifactId>
                  <version>2.2.2</version>
                  <scope>runtime</scope>
          </dependency>          
          <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-entitymanager</artifactId>
                  <version>4.1.8.Final</version>
          </dependency>
</dependencies>
</project>

4) Troubleshooting Dependency Problem

4.1) primefaces could not be found
Solution: add external repositories on top of <dependencies> tag.
<repositories>
        <repository>
                <id>prime-repo<id>
                <name>PrimeFaces Maven Repository</name>
                <url>http://repository.primefaces.org</url>
        </repository>
</repositories>
4.2) Oracle ojdbc could not be found
Solution: download the ojdbc jar file from Oracle website and install manually using the following codes:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.1.0 -Dpackaging=jar -Dfile=ojdbc14.jar -DgeneratePom=true
---

No comments:

Post a Comment