Quantcast
Channel: Redino blog
Viewing all articles
Browse latest Browse all 80

IDEA Build got error: package org.springframework.web.servlet.config.annotation does not exist

$
0
0

When building project in IDEA 2021.1, following error appeared:

package org.springframework.web.servlet.config.annotation does not exist

And the weired thing is that running mvn compile in command line works well, but run Build in IDEA will got this error.

The building process works before, but recently I modified source code of one of my dependency JHCommonLibrary which is depending on spring-webmvc

<dependency>
        <groupId>com.juhe</groupId>
        <artifactId>JHCommonLibrary</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>

I remove spring-webmvc dependency from JHCommonLibrary but it didn't work.

<dependency>
        <groupId>com.juhe</groupId>
        <artifactId>JHCommonLibrary</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

Then add spring-webmvc explicitly, and it didn't work as well.

<dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webmvc</artifactId>
          <version>4.3.9.RELEASE</version>
      </dependency>

Solution

Finally, I move JHCommonLibrary to end of <dependencies>, now it works. Or adding spring-webmvc dependency before JHCommonLibrary also works.

(I need to state again, this issue only appeared in IDEA but not appear if running mvn compile in command line. So it's likey a bug in IDEA)

The post IDEA Build got error: package org.springframework.web.servlet.config.annotation does not exist appeared first on Redino blog.


Viewing all articles
Browse latest Browse all 80

Trending Articles