I'm using Maven2 and Spring 3, when I run my project in Eclipse everything works fine, but when I use assembly:assembly, the resultant jar throws the following Exception:
Exception in thread "main"
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 4
in XML document from class path resource [beans.xml] is invalid; nested exception
is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of
element 'beans'.
my beans file looks something like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- Beans Here -->
</beans>
this file is stored in src/main/resources
my pom.xml has the following dependency for spring:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.3.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
any ideas why this is happening? how to fix?
UPDATE:
further probing Google turns out that Spring and Maven don't get on too well with the following in my pom.xml, although no solution is forthcoming:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<archive>
<manifest>
<mainClass>org.robert.xclades.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>