PDA

View Full Version : Error building the sample app using Maven 2



jr@2ft
Oct 23rd, 2006, 04:17 PM
Hi,

Has anyone tested the sample application using Maven? I've unfortunately spent my entire day trying to debug this. Here were my steps

1) i downloaded the distribution with the sample application in spring-ldap/spring-ldap-article

2) I used this basic POM, which includes the *minimum* dependencies to test

<?xml version="1.0"?><project>

<modelVersion>4.0.0</modelVersion>
<groupId>com.mcgrawhill.core</groupId>
<artifactId>hrtech</artifactId>
<name>Maven Quick Start Archetype</name>
<version>1.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
</plugins>
</reporting>

<repositories>
<repository>
<id>mergere</id>
<url>http://repo.mergere.com/maven2</url>
</repository>
<repository>
<id>central</id>
<url>http://ibiblio.org/maven2</url>
</repository>
<repository>
<id>spring</id>
<url>https://svn.sourceforge.net/svnroot/springframework/repos/repo/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>http://snapshots.repository.codehaus.org</url>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.1</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>1.2.7</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.13</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

3) I moved the config/ and com/... directories from itest/ to test/

4) i had to change this line in AbstractPersonDaoIntegrationTest

from:

protected String[] getConfigLocations() {
return new String[] { "config/testContext.xml" };
}

to:

protected String[] getConfigLocations() {
return new String[] { "classpath*:**/config/testContext.xml" };
}

5) running "mvn test" yields

Error creating bean with name 'org.springframework.ldap.samples.article.dao.Pers onDaoImplIntegrationTest': Unsatisfied dependency expressed through bean property 'personDao': Set this property value or disable dependency checking for this bean.

for every test.

If there are any questions about spring 1.2.7 vs. 2.0, i've used all these combinations

java 1.4.2 vs. 1.5
spring 1.2.7 vs 2.0

... all the same results =(

Any help is greatly appreciated.

JR

jr@2ft
Oct 25th, 2006, 10:38 AM
Hi, I was able to get this working and (shocking) it had nothing to do with Spring-Ldap. Regardless, I wanted to be a good sport and post my solution

http://www.twofeetthick.com/jr/2006/10/debugging-maven-spring.html

JR

rasky
Oct 25th, 2006, 12:58 PM
Thanks for the informative post.

I kept the applicationContext-springldap.xml amongst the java classes because well ... that's how example was packaged.
Guess we should move it to a resource directory instead in the example...