On 10/11/2010 3:40 PM, marshall wrote:
Hi;
  This is probably a beginner question, but I thought it was worth posing 
because it is frequently very frustrating when working with Maven.
  Is there a clear way to know which particular dependencies Maven requires, 
when working with a set of jars/libraries?
  For example, I have been trying to get JPA and Hibernate configured properly 
in the pom.xml. I have tried so many different variations of dependencies 
(hibernate, hibernate-core, javax.persistence, JPA, MySQL, etc.) that I finally 
just threw up my hands in frustration.
I can get a Hibernate/JPA/MySQL application working just fine without Maven, 
but when I try to integrate Maven I'm lost as to which dependencies it needs. 
They seem to be different than the jars/libraries I specify in the classpath 
for a non-Maven build.
Thanks;
Mar



We use Hibernate and Mysql all the time in Maven and have no problem specifying the versions As you can see below, we only need 3 dependencies to get enough to make it all run and one of them is a connector for MS-SQL which we use against a remote database at another company.

This POM controls the dependencies of Hibernate and Mysql. It is mostly exclusions to stop old versions of libraries from being dragged in by mistake. It took a bit of doing to get these the first time but it is nice now that we do not have a screen full of conflicting version notes.

This is used as a dependency of other similar POMs until we get a POM that contains the major framwork dependencies
"lms-pom-spring-hibernate-mysql-tomcat" which actual applications depend on.
When we want to change the MySQL connector, we only change it here and rebuild the other POMs to get everyone in synch. The developer who is building a web service, servlet or portlet has no concern about the actual versions of the lower level stuff. He is building with 1.9.1 of our base and gets whatever is supposed to be there.


We do the same thing for the Apache commons, CXF, Jasper dependencies, etc. We have about 10 in total. Most projects only need 5 or fewer dependencies to get everything and everything is a lot!

lms - Learning Management System - is the application umbrella.

We can usually release these very early in the project since these do not change very often but we do build a set of SNAPSHOTs to start.

<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>
<parent>
<artifactId>lms-pom-master</artifactId>
<groupId>com.company.lms</groupId>
<version>1.9.1</version>
</parent>

<groupId>com.company.lms</groupId>
<artifactId>lms-pom-hibernate-mysql</artifactId>
<packaging>pom</packaging>
<name>Hibernate-MySQL</name>
<version>1.9.1</version>

<description>Hibernate and MySQL</description>

<properties>
<hibernate.version>3.2.6.ga</hibernate.version>
<mysql-connector-java.version>5.1.10</mysql-connector-java.version>
<jtds.version>1.2.2</jtds.version>
</properties>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
<exclusion>
<artifactId>asm</artifactId>
<groupId>asm</groupId>
</exclusion>
<exclusion>
<artifactId>cglib</artifactId>
<groupId>cglib</groupId>
</exclusion>
<exclusion>
<artifactId>antlr</artifactId>
<groupId>antlr</groupId>
</exclusion>
<exclusion>
<artifactId>jta</artifactId>
<groupId>javax.transaction</groupId>
</exclusion>
<exclusion>
<artifactId>dom4j</artifactId>
<groupId>dom4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>${jtds.version}</version>
</dependency>
</dependencies>

</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to