Copy this link when reproducing:
http://www.casperlee.com/en/y/blog/82
1. Make sure JDK, Tomcat server, and Eclipse have been installed to the computer and configured properly. Please see http://www.casperlee.com/x/y/blog/78 for detail steps.
2. Run Eclipse.
3. Select "File -> New -> Project..." from the menu.
4. Select "Maven -> Maven Project" and click "Next >" to continue.
5. Click "Next >" to continue.
6. Select the maven-archetype-quickstart, and click "Next >" to continue.
7. Type in "Group Id", "Artifact Id", and "Package name", click "Finish", a maven project will be created.
8. Open "pom.xml", you will find a section named "dependencies". Put the dependencies into this section, for instance:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.10.RELEASE</version>
</dependency>
9. Save the file, a dialog popped up. Eclipse will download the framework for us automatically.
10. After the downloading process finished, the jars will be downloaded to the computer.
Note: When using these jars, you may encounter the "invalid LOC header" error:
...
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:113)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
... 33 more
...
This is a problem of corrupted jars. Here is the solution to fix this error:
1. Use 7-Zip (http://www.7-zip.org/) or what ever you like to unzip all of those downloaded jars one by one, and figure out which jars are corrupted.
2. Delete the corrupted jars in the "C:\Users\[UserName]\.m2\repository" directory.
3. Right click on the maven project which has been used to download those jars, select "Maven -> Update Project...".
4. Tick "Force Update of Snapshots/Releases", click "OK" to download the library again.
5. If it still doesn't work, repeat these steps until a non-corrupted file is downloaded.