I am getting the following error when run spring boot application.
Actually .m2 repository accidentally deleted. When re-running the application it is updated, but it is showing the following error. please do help in this regard.
Archive for required library:
C:/Users/Sathish/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.6/tomcat-embed-core-8.5.6.jar'
in project 'Application' cannot be read or is not a valid ZIP file
Looks like the mentioned JAR file in the local Maven repository is corrupt. I would delete this file manually from the repository, go back to STS, and run an "Maven -> Update Project...", maybe also checking the "Force Download of Snapshots/Releases". That should help.
Related
I have recently installed Spring Tool Suite 4.0.1 on Ubuntu 18.04 and tried to run hello world spring application but it gives the following compile-time error. I have searched on google a lot but cannot find the relevant info.
Error:
"Description Resource Path Location Type
Archive for required library: '/home/anshul/.m2/repository/org/springframework/spring-test/5.1.2.RELEASE/spring-test-5.1.2.RELEASE.jar' in project 'demo' cannot be read or is not a valid ZIP file"
It looks like the JAR file in your local Maven repository is corrupted. The easiest way to solve this is to completely wipe out the local Maven repo (delete everything under .m2/repository and kick off an Update Maven Project... in STS. That will trigger Maven to download the dependencies again.
I am working on a gradle project that should run on a machine without internet connection.
For that, I have created a task that takes the gradle cache and copies it into another directory, to be used as a local repository.
I have built the project in online mode and it worked.
I have ran my task to copy the cache to the local repository and it worked.
However, when trying to run gradle build --offline I am getting errors like this (for several different jar files):
Could not download commons-math3.jar (org.apache.commons:commons-math3:3.4.1): No cached version available for offline mode
Checking both my local repository and the gradle cache, I couldn't find the relevant jar file (in this case commons-math3-3.4.1.jar).
I have tried using gradle build --refresh-dependencies, I have tried to delete the cache and then using gradle build - nothing, it wouldn't download the jar files, only the pom files.
I have even tried to download the jars manually and put them in the correct directories in my local repository did not work.
Any help would be appreciated.
I don't think the Gradle cache can be transferred to another machine like this. I'm trying to create a plugin which can copy the dependencies from a configuration to a local directory for offline usage here but I've hit this issue where parent POM's and BOM's can't be accessed from the Gradle API's. I've got a failing test here demonstrating the usage of the plugin and the lack of parent POM support.
One of the suggestions on the issue is to try the IvyPot plugin. I haven't tried this myself but it might work for what you are attempting.
You might have proxy enabled, add proxy details in "gradle.properties" file like below:
systemProp.http.proxyHost=your.proxy.com
systemProp.http.proxyPort=XXXX
systemProp.http.proxyUser=user
systemProp.http.proxyPassword=password
I follow this tutorial to create spring boot project, when I run the project, it shows an error. Please help me to fix it.
my pom.xml
You mentioned that it worked with gradle but not Maven.
One possible solution is to delete your local maven repository to force it to redownload the dependencies:
Go to your home folder and remove the folder ~/.m2/repository.
Then, try rebuilding your project with maven : mvn clean install
I try to update Java and Maven,but it also do not work,and then I change Maven to Gradle,the application can run! Maybe Maven has problem.
Can some one please help me in below:
I am using RTC and checkout Gradle project, but at the end when I am checking the properties and looking for source folder for my build, I am getting nothing.
Also I am not send the repository specific Gradle jars. What i am doing wrong?
I tried including external jars but no luck as their are too many jars.
Error: project is not at all building.
right click on your project then configure and convert it to gradle project.
Refresh and you will see all dependencies.
i am getting this exception when try to run as-> maven build
.m2\repository\commons-logging\commons-logging\1.1\commons-logging-1.1.jar; cannot read zip file entry
I've already spent a day on it , searched over google , but no luck
any idea how can i resolve this
thanks
Try to open the jar with a Zip utility (7Zip ou something else).
If it fails, delete the file from your local repository, and retry to run your app.
If it fails again, then you may have an issue with your Maven repos config.
If maven downloads corrupt jars (jars that do not open with a zip utility) - try downloading those perticular jars manually and replace them in the appropriate repository folder location.
In settings.xml specify the localRepository path explicitly. Using the default settings (i.e. not specifing localRepository) causes maven to download the jars again and again when you do a "clean install" and you end up have the corrupt jars again.
In my experience, it is caused by a corrupted zip file. A failed build often appends to the jar, but doesn't delete it, therefore producing an unreadable file.
The solution, as suggested, is to delete the jar, then try to download again from the repository (create a maven build with package goal) If that repeatedly fails, the remote location might be corrupted.
Delete the m2 repository folder and try running your maven ,it will download all the jar files again and the build success