The Javaweb project, which has been used to install the MAVEN package for spring, is packaged with MVN assembly:assembly, this time wrapping the non-web spring project, encountering many problems and recording the correct steps.
1. Configure Pom.xml
There is no need to assembly, because Assembly will only be in the packaging of the first encounter of the file into the jar package, after the encounter will skip. That is to say, assembly my spring description file is ignored. The error is: Can't find spring-context.xml (my config spring xml), so here with Maven-shade-plugin
1<build>2<plugins>3<plugin>4<groupId>org.apache.maven.plugins</groupId>5<artifactId>maven-shade-plugin</artifactId>6<version>1.4</version>7<executions>8<execution>9<phase> Package</phase>Ten<goals> One<goal>shade</goal> A</goals> -<configuration> -<transformers> the<Transformer -implementation= "Org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" > -<mainClass>com.peak.App</mainClass> -</transformer> +<Transformer -implementation= "Org.apache.maven.plugins.shade.resource.AppendingTransformer" > +<resource>META-INF/spring.handlers</resource> A</transformer> at<Transformer -implementation= "Org.apache.maven.plugins.shade.resource.AppendingTransformer" > -<resource>META-INF/spring.schemas</resource> -</transformer> -<Transformer -implementation= "Org.apache.maven.plugins.shade.resource.AppendingTransformer" > in<resource>META-INF/spring.tooling</resource> -</transformer> to</transformers> +</configuration> -</execution> the</executions> *</plugin> $</plugins>Panax Notoginseng</build>
Configuration in 2.idea
Because idea integrates Maven, there's no need to install MAVEN specifically
3.clean and package (double-click to run)
The Java Project (non-web) that uses MAVEN to package spring in idea