No puedo empaquetar mi proyecto a un jar con dependencias

Buenos días compañeros.

Mi pregunta es como podría generar un ejecutable de un proyecto maven???.
He leido que basta con editar el archivo pom.xml pero al editarlo y poner el código para generarlo me sale un error del archivo de configuración de Spring.
Aqui dejo mi pom.xml donde pongo mis plugins para poder empaquetar mi jar completo.

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
                            <overWriteReleases>true</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>com.paquete.paquete_server.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plug

El archivo de configuración de Spring es el siguiente:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:cache="http://www.springframework.org/schema/cache"
       xmlns:p="http://www.springframework.org/schema/p"
   
       xsi:schemaLocation="http://www.springframework.org/schema/beans <a href="http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
" title="http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
">http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
</a>          <a href="
http://www.springframework.org/schema/aop" title="http://www.springframework.org/schema/aop">http://www.springframework.org/schema/aop</a> <a href="http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
" title="http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
">http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
</a>          <a href="
http://www.springframework.org/schema/context" title="http://www.springframework.org/schema/context">http://www.springframework.org/schema/context</a> <a href="http://www.springframework.org/schema/context/spring-context-3.0.xsd
" title="http://www.springframework.org/schema/context/spring-context-3.0.xsd
">http://www.springframework.org/schema/context/spring-context-3.0.xsd
</a>          <a href="
http://www.springframework.org/schema/tx" title="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a> <a href="http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
" title="http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
">http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
</a>          <a href="
http://www.springframework.org/schema/util" title="http://www.springframework.org/schema/util">http://www.springframework.org/schema/util</a> <a href="http://www.springframework.org/schema/util/spring-util-3.0.xsd
" title="http://www.springframework.org/schema/util/spring-util-3.0.xsd
">http://www.springframework.org/schema/util/spring-util-3.0.xsd
</a>         <a href="
http://www.springframework.org/schema/cache" title="http://www.springframework.org/schema/cache">http://www.springframework.org/schema/cache</a> <a href="http://www.springframework.org/schema/cache/spring-cache.xsd
">
"
title="http://www.springframework.org/schema/cache/spring-cache.xsd
"
>
">http://www.springframework.org/schema/cache/spring-cache.xsd
"
>
</a>    <context:annotation-config />  
    <context:component-scan base-package="paquete.com" />  
    <tx:annotation-driven transaction-manager="transactionManager"/>  
   
   
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
        <property name="locations">  
            <list>  
                <value>classpath:hibernate.properties</value>
                <value>hibernate.properties</value>
            </list>  
        </property>  
    </bean>
    <bean id="dataSource" depends-on="propertyConfigurer"  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="${hibernate.connection.driver_class}" />
        <property name="url" value="${hibernate.connection.url}" />
        <property name="username" value="${hibernate.connection.username}" />
        <property name="password" value="${hibernate.connection.password}" />
    </bean>
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">  
        <property name="dataSource" ref="dataSource" />          
        <property name="configLocation" value="classpath:${hibernate.cfg.file}" />        
    </bean>
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">          
        <property name="sessionFactory" ref="sessionFactory" />          
    </bean>
</beans>

El error que me sale al tratar de ejecutar el jar con dependiencias es el siguiente:

Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: class path resource [SpringXMLConfig.xml]

at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:284)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1328)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)
at com.pos.upgradepos_server.utilidades.SpringContextLoad.getContext(SpringContextLoad.java:20)
at com.pos.upgradepos_server.vistas.Main.IniciarServicios(Main.java:26)
at com.pos.upgradepos_server.vistas.Main.main(Main.java:21)

Espero me puedan apoyar.

De antemano gracias.

Comentarios

Opciones de visualización de comentarios

Seleccione la forma que prefiera para mostrar los comentarios y haga clic en «Guardar las opciones» para activar los cambios.

Re: jar con dependencias

 

Utiliza el plugin maven-shade-plugin para construir un jar con dependencias. Aquí te dejo un ejemplo de uso.

~~~

Imagen de adrianaaae

Nou

Gracias por tu apoyo
me sale el siguieente error al tratar de ejecutar la aplicacion generada:

Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: class path resource [SpringXMLConfig.xml]

lo agregue de la siguiente manera en el pm.xml

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Main-Class>paq.com.Main</Main-Class>
                                        <Build-Number>0.0.1</Build-Number>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
<!--                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>-->
                        </configuration>
                    </execution>
                </executions>
            </plugin>
Imagen de adrianaaae

Alguien me puede ayudar???

Alguien me puede ayudar con el problema???
El proyecto maven tiene los frameworks de Hibernate 3.5.6-Final y Spring 3.0.6.RELEASE
Quiero empaquetar mi proyecto en un jar que pueda ejecutar, tal como se genera cuando no usas maven y te genera la
carpeta dist (en ella se guarda el ejecutable y sus librerías) y se puede ejecutar.

Quiero hacer los mismo con este proyecto maven.