Asked  7 Months ago    Answers:  5   Viewed   8 times

I imported my already working project on another computer and it started to download dependencies.

Apparently my internet connection crashed and now I get the following:

    >Build errors for comics; org.apache.maven.lifecycle.LifecycleExecutionException:
    Failed to execute goal on project comicsTest: Could not resolve dependencies for project comicsTest:comicsTest:war:0.0.1-SNAPSHOT:
    The following artifacts could not be resolved:
    org.springframework:spring-context:jar:3.0.5.RELEASE,
    org.hibernate:hibernate-entitymanager:jar:3.6.0.Final,
    org.hibernate:hibernate-core:jar:3.6.0.Final,
    org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final,
    org.aspectj:aspectjweaver:jar:1.6.8,
    commons-lang:commons-lang:jar:2.5,

    >mysql:mysql-connector-java:jar:5.1.13: Failure to transfer org.springframework:spring-context:jar:3.0.5.RELEASE 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.springframework:spring-context:jar:3.0.5.RELEASE from central (http://repo1.maven.org/maven2): No response received after 60000

How do I force maven to update?

 Answers

64
mvn clean install -U

-U means force update of snapshot dependencies.

Release dependencies will be updated this way if they have never been previously successfully downloaded. ref: https://stackoverflow.com/a/29020990/32453

Tuesday, June 1, 2021
 
maniclorn
answered 7 Months ago
72

Click on the "maven projects" (make sure tool buttons are on) on the right side of intelij and then click on "Download Documentation".

Also, for future downloading you can go to the File -> Settings -> Build,execution, deployment, -> build tools -> Maven -> importing -> mark "Documentation" checkbox and apply settings

Wednesday, June 23, 2021
 
mschuett
answered 6 Months ago
37

Both of your solutions wouldn't help, as they would add an additional resource that is then deactivated. The webapp source folder is copied by default, without the resource mechanism.

The mechanism to deactivate a part of that is through the <warSourceExcludes> parameter, like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1</version>
    <configuration>
        <warSourceExcludes>webscripts/**</warSourceExcludes>
    </configuration>
</plugin>
Tuesday, June 29, 2021
 
toesslab
answered 6 Months ago
40

It seems as though directory browsing on http://repo1.maven.org/maven2 has been switched off. I had to resort to getting the archetype catalog myself. I did this:

mvn archetype:generate -DarchetypeCatalog=http://search.maven.org/remotecontent?filepath=archetype-catalog.xml

Alternatively I guess you could just download the archetype-catalog.xml file from that link and place it in your .m2 directory as mentioned in this comment:

http://jira.codehaus.org/browse/ARCHETYPE-202?focusedCommentId=182771&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-182771

Tuesday, August 3, 2021
 
van_folmert
answered 4 Months ago
69

Here is what happens:

  1. mvn clean deletes the target directory
  2. mvn package performs some work, but then encounters a compilation error due to a missing dependency. That's why the target folder is in error.
  3. Running Maven > Update Project in Eclipse causes Eclipse to perform its own compilation, separate from Maven. Eclipse has a different classpath than Maven, so its compilation succeeds. Now the target directory has all the compiled classes.
  4. Re-running mvn package now succeeds, because it finds all the classes already compiled and doesn't need to perform any compilation.

Ultimately, the problem is in the project configuration in pom.xml. I had the same problem, and after adding the missing dependency I successfully compiled project with Maven.

Wednesday, August 11, 2021
 
inieto
answered 4 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :  
Share