When I create a new Java web project with Maven and add Spring Framework
support and try to build it I get an error message "Failure to find
org.springframework:spring-framework-bom:jar:4.0.1.RELEASE"

The same is true for the 3.x version of Spring Framework. All I did was

New Project -> Java with Maven -> Web Application and put in my name and
folder info for the project.

Next I right click the project
Properties -> Frameworks -> Add -> Spring MVC -> select 4.0.1 and include
JSTL

As soon as I do that I get a warning on the project. If I expand the list
of dependencies all look fine except for
spring-framework-bom-4.0.1.RELEASE.jar if I hover over it I see "Dependency
not yet downloaded. Build project to correct errors." So I build and get
the following error"

Failed to execute goal on project REPhotoTours: Could not resolve
dependencies for project com.mydomain:MyNetbeansProject:war:1.0-SNAPSHOT:
Failure to find org.springframework:spring-framework-bom:jar:4.0.1.RELEASE
in 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 -> [Help 1]

I found this solution online
https://stackoverflow.com/questions/37625875/dependency-resolution-exception-in-
netbeans
-maven-web-application-for-spring-fra/38700407#38700407?newreg=1a731c3515884682a1efef40fe33c3b0

Which suggested adding type and scope to the dependency in pom.xml.

<dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-framework-bom</artifactId>
      <version>4.0.1.RELEASE</version>
      <type>pom</type>
      <scope>import</scope>
</dependency>

When I do that, it works. This is an old thread so it doesn't make sense
that Netbeans would have an error in such a popular framework for a few
years without it being fixed so I think there might be something wrong with
my configuration.

I'm not that familiar with Maven. Can someone explain what adding type and
scope exactly does and why it fixes it? Should it work in Netbeans without
that? What should I be looking for?

I'm using JDK-13.0.2 on windows 10 64 bit.

Reply via email to