SpringSource Spring MVC Template errors when created - java

I'm just getting started with SpringSource, so I decided to make a Spring MVC project off the template.
However, as soon as I create the template, I get the following error in pom.xml
Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 () (org.apache.maven.plugins:maven-resources-plugin:2.5:resources:default-resources:process-resources)
Failure to transfer org.codehaus.plexus:plexus-container-default:pom:1.0-alpha-9-stable-1 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-container-default:pom:1.0-alpha-9-stable-1 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.pom
I've tried reinstalling SpringSource multiple times, and I still get the same error. I'm using SpringSource 3.1.0 32-bit version on a 64-bit Windows 7 machine.

I think you need to update your Maven indexes so that it can download the appropriate library required for the template.
Go to Window > Preferences > Maven
Check Download Repository index updates on startup
Restart STS.
Attempt to pull down the template again.
Note: It may take some time to download all of the indexes.

For me deleting the contents in my .m2/repository folder and recreating the project (file-> new->) worked

Related

Can't add spring boot devtools dependency in pom.xml file [duplicate]

This question already has answers here:
Maven error "Failure to transfer..."
(25 answers)
Closed 11 months ago.
When starting the application following resolving issue is raised.
Cannot resolve org.springframework.boot:spring-boot-devtools:pom:2.6.5 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt.
This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced.
Original error: Could not transfer artifact org.springframework.boot:spring-boot-devtools:pom:2.6.5 from/to central (https://repo.maven.apache.org/maven2):
transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-devtools/2.6.5/spring-boot-devtools-2.6.5.pom
The URL is reachable.
It seems that your local version (inside ~/.m2/repository) of this dependency is corrupted. Try deleting it there and restart the download process from maven central again.
When you build the application after adding a dependency when maven try to download the artifact and its dependencies the download may fail for some reason (may be a network issue) then maven put a file with the timestamp of the first try. if you try maven build after that first try maven reorganize the first try failed and check the timestamp to check weather sufficient time has elapsed if not it will throw This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced
If you want to force maven to update the dependencies those are failed before update interval you can use -U switch.
So run you maven goal with -U switch like mvn <goal> -U

"Could not resolve archetype" error on Maven at Eclipse Oxygen while creating project

I am getting the following error while creating a maven-archtype project in my Eclipse Oxygen.
Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0
Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
I can access the Maven Repository perfectly well from my browser using following link:
https://repo.maven.apache.org/maven2/
I am using my office laptop and its sitting behind a secure network.
By referring answers on other similar questions I have already tried to put settings.xml at .m2 directory. I don't know which proxy to use so I just put my system credentials for username and password tags. But this did not work.
I have also tried to add Maven_Archtype in Eclipse Maven settings. Still not working.
Has anyone faced this issue? Please point me to a correct solution its its already been answered.
This normally happens when you have already installed Eclipse older version like Kepler or Mars, and then you install newer version separately, this newer version accesses some directories of older version.So,
Go to----> C:\Users\Irfan (your user name)
Delete these two folders .eclipse and .m2 .
Reinstall the newer version of Eclipse again.

Maven update project and dependencies

In an application that worked until now, I run in Eclipse the command Maven->Update project and I started getting errors.
I tried to fix it by deleting all the local repository and running Maven->Update project again. But these are the errors that I still see in my Markers view:
Missing artifact org.slf4j:slf4j-api:jar:1.6.6
Missing artifact org.slf4j:slf4j-api:jar:1.6.6
ArtifactTransferException: Failure to transfer org.slf4j:slf4j-api:jar:1.6.6 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of
ArtifactTransferException: Failure to transfer org.slf4j:slf4j-api:jar:1.6.6 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of
Error occured processing XML 'org/springframework/transaction/interceptor/TransactionInterceptor'. See Error Log for more details
The code hasn't changed and worked fine before.
Any idea on how I can fix these errors?
I am not sure about the particular mentioned jar.
But when you do build you should be connected to internet cause some external jar referred in POM get downloaded while building your project.
Also please check whether the mentioned jar is is maven repository or not.
Above jar is related to slf4j so i think it will be resolved if you are connected to internet .
Perhaps the SL4J jar is partially downloaded in your maven local repository. Try deleting it if it exists in the local repository. If that fails try creating a new dir called repository; mine is stored in ~/.m2 (ubuntu). Out of paranoia I rename the current dir as not to lose the jars already inside it.

Maven not able to download dependency

I have started working on a new project using Maven, and I'm unable to have it work properly on eclipse. I have multiples of this error :
ArtifactTransferException: Failure to transfer com.caucho:hessian:jar:3.1.5 from <repository> was cached in the local repository, resolution will not be reattempted until the update interval of Archiva SIVPN Internal has elapsed or updates are forced. Original error: Could not transfer artifact com.caucho:hessian:jar:3.1.5 from/to Archiva SIVPN Internal (<repository>): No response received after 60000 pom.xml /<file> line 2 Maven Dependency Problem
Description Resource Path Location Type
Missing artifact com.caucho:hessian:jar:3.1.5 pom.xml / line 2 Maven Dependency Problem
After doing some research, I found that it was probably either the pom.xml that's wrong, or that I have proxy problems.
I checked that the resource was available on our repository, and that the pom snippet is the same as declared in my code :
<dependency>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
<version>3.1.5</version>
</dependency>
My proxy works just fine for the trunk of the project, and there is no other proxy I'm aware of.
I thought it was maybe a one-time connection problem, but making a new maven build with -U didn't resolve the problem.
I also found https://stackoverflow.com/questions/6111408/maven2-missing-artifact-but-jars-are-in-place
with several I-don't-know-what-else-to-do solutions, but it didn't work for me...
Since the lead developer is on vacation and I have little experience on mvn, could someone tell me other potential problems that could be responsible for this ?
Thanks in advance for answers :)
Open a command prompt, go to your project directory and run: mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
The eclipse:eclipse portion will regenerate your project files etc, the last 2 properties are more for convenience but I like downloading the sources and javadoc.
After a failed attempt, maven will leave a small file in your local .m2 repository that will prevent any attempt to re-download the file unless the update interval has elapsed or you force the updates using the maven -U switch described in other answers.
Just delete the folder for that artifact in your local m2 repository and update you project; a new download attempt will trigger.
rm -rf ~/.m2/repository/com/caucho/hessian/3.1.5

m2eclipse will not download any dependencies

I was hoping someone might be able to help.
On a brand new windows machine. I've downloaded and installed java jdk before downloading and running the latest version of eclipse (indigo).
From there I have installed the maven integration plugin from the marketplace and created a new maven projected.
The project has a ton of errors mainly to do with missing dependencies or life cycle management.
When I do maven-clean I get the following error message:
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo1.maven.org/maven2): Invalid argument: getsockname to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom -> [Help 1]
I am not behind a firewall and I do not use a proxy. My maven settings.xml is completely default as is my maven project. No classes added, nothing added to the pom.
Can anyone help?
All the best.
p.s here are the errors shown in the pom:
1:
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (http://repo1.maven.org/maven2): Invalid argument: getsockname to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom
2:
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile)
3:
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile)
4:
Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 from/to central (http://repo1.maven.org/maven2): Invalid argument: getsockname to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.3/maven-resources-plugin-2.4.3.pom
Furthermore i recommend to test the configuration etc. first with command line client of Maven (Maven 3.0.X) and not within Eclipse.
The 1./4. shows that you have tried to download some artifact which has failed for whatever reasons. The simple solution for that is to delete the local repository and retry the build. But i recommend to do that first on command line to check if everything is fine.
The 2./3. are indications that the project you are trying to compile does not contain a correct plugin coverage for m2e which can be read in the docs how to solve that.
Problem:
You are missing an artefact in Your maven repository.
How to verify:
If You will browse Your repository You will find out that under .m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1/ artefact will have lastUpdated suffix - maven attempted to download this artefact but failed.
How to solve:
Just add an appropriate artefact into Your maven repository:) There are several ways how to do that but the simplest one will be dropping the folder with the missing artefact. Add since You can build Your project from the CMD just add missing artefact as a dependency into Your project. Build the project from the CMD.
Add dependency is not working through eclipse IDE(JUNO 4.2). Fixed the issue by manually adding dependencies with the below command on command prompt
go to the location where your pom.xml is located
mvn install
once you see status BUILD success from now onwards we can proceed with IDE.
Clearly this is an issue of proxy. Either use VPN or edit procy setting in setting.xml. I searched lot about this error. Finally, I used VPN(Virtual private network ) to disable the proxy and was able to use cetral repository of Maven.
IF you dont want to USE VPN just change Settings.xml host address with proxy address of ur company(which is available in IE->tools->connection->LAN settings->advanced->http. )
This is a proxy problem:
add your proxy config in your setting.xml
remove .m2 folder from your home directory
run any maven command in interactive mode from command line, for example try to create a project
mvn archetype: generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.mycompany.app -DartifactId=my-webapp
that's all
I had the same problem. It was because I configured the repository in the settings.xml of my Maven Installation. But this in not used by Eclipse as it comes with its own Maven implementation. You need to configure the repositories (mirror section) in the settings.xml in your profile (.m2/settings.xml).

Categories

Resources