2
votes

I'm struggling to make my setup to work Intellij + SpringBoot. I downloaded a regular pom.xml from spring initializr. When i build/run the project it does not find spring boot dependencies, but running mvnw spring-boot:run works fine. So i assume it might be something with IntelliJ, but simply can't figure it out. NOTE: This is a new installation of everything. And using

openjdk version "1.8.0_252" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)

My Maven Settings are default

Maven Settings

Am I escaping something ? BR

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.sergio</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project> 

Errors

Information:java: Errors occurred while compiling module 'demo'
Information:javac 1.8.0_252 was used to compile java sources
Information:18/04/2020 02:42 - Build completed with 18 errors and 0 warnings in 4 s 255 ms
C:\Users\Sergio\Desktop\demo\src\main\java\com\sergio\demo\DemoApplication.java
    Error:Error:line (3)java: package org.springframework.boot does not exist
    Error:Error:line (4)java: package org.springframework.boot.autoconfigure does not exist
    Error:Error:line (5)java: package org.springframework.web.bind.annotation does not exist
    Error:Error:line (6)java: package org.springframework.web.bind.annotation does not exist
    Error:Error:line (8)java: cannot find symbol
  symbol: class SpringBootApplication
    Error:Error:line (12)java: cannot find symbol
  symbol:   variable SpringApplication
  location: class com.sergio.demo.DemoApplication
C:\Users\Sergio\Desktop\demo\src\main\java\com\sergio\demo\Entity\AnimeNew.java
    Error:Error:line (4)java: package lombok does not exist
    Error:Error:line (5)java: package lombok does not exist
    Error:Error:line (6)java: package lombok does not exist
    Error:Error:line (7)java: package lombok does not exist
    Error:Error:line (14)java: cannot find symbol
  symbol: class Getter
    Error:Error:line (15)java: cannot find symbol
  symbol: class RequiredArgsConstructor
    Error:Error:line (18)java: cannot find symbol
  symbol:   class NonNull
  location: class com.sergio.demo.Entity.AnimeNew
    Error:Error:line (19)java: cannot find symbol
  symbol:   class NonNull
  location: class com.sergio.demo.Entity.AnimeNew
    Error:Error:line (20)java: cannot find symbol
  symbol:   class NonNull
  location: class com.sergio.demo.Entity.AnimeNew
    Error:Error:line (21)java: cannot find symbol
  symbol:   class NonNull
  location: class com.sergio.demo.Entity.AnimeNew
    Error:Error:line (22)java: cannot find symbol
  symbol:   class NonNull
  location: class com.sergio.demo.Entity.AnimeNew
    Error:Error:line (23)java: cannot find symbol
  symbol:   class NonNull
  location: class com.sergio.demo.Entity.AnimeNew

EDIT 1: Got the full log from intelij https://drive.google.com/file/d/1NpIJg-OYi7PGfWMNAVeSDBakU9bOaB20/view?usp=sharing

1
Try to build on plain command line first...and lets see if there are errors or not...khmarbaise
same error cannot be foundNoize
can you post the log output during the build...best would be the full output..khmarbaise
the log output is the same as above on my original post ErrorsNoize
If command line Maven build also fails - this means the Maven is unable to download these libraries form the Maven repository. You have the parent section declared in pom.xml. Then you need to make sure this parent Maven project must exist in your local repository. Check your network configuration: if you have proxy, make sure it is configured in Maven. Also verify you haveAndrey

1 Answers

2
votes

Try installing lombok in intellij IDEA:

  1. Go to File > Settings > Plugins.
  2. Click on Browse repositories...
  3. Search for Lombok Plugin.
  4. Click on Install plugin.
  5. Restart IntelliJ IDEA.

If that still doesn't work, try: File->Invalidate cache and restart and then build your project. Hope this helps.