Search code examples
javaintellij-idea

Upgraded to a new version of IntelliJ 2024.1.6 and my java project will not build


I have just upgraded to IntelliJ IDEA 2024.1.6 (Ultimate Edition) Now my java project is not compiling and getting strange results.

I have tried to invalidate the caches.

I have right clicked on the pom.xml and selected maven->reload project

The image below is the best way to describe my Issue.

When i build the project it fails with org.jsoup does not exist, although to me it appears that it does as seen in the image.

I am a loss of what to do or how to fix this.

Anything else I can provide here to help me resolve this issue please let me know

This is the best way to describe my issue-

This is my pom.xml

<?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>

<groupId>com.unitnet</groupId>
<artifactId>newsLetterPDF</artifactId>
<version>1.0.0</version>
<name>newsLetterPDF</name>
<packaging>war</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
    <junit.version>5.8.2</junit.version>
</properties>


<dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>4.0.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet</artifactId>
        <version>2.34</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>2.34</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.inject</groupId>
        <artifactId>jersey-cdi2-se</artifactId>
        <version>2.34</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.weld.se</groupId>
        <artifactId>weld-se-core</artifactId>
        <version>3.1.8.Final</version>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox</artifactId>
        <version>2.0.31</version>
    </dependency>
    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox-tools</artifactId>
        <version>2.0.31</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.20.0</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.31</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
    </dependency>


    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-rs-security-cors</artifactId>
        <version>2.6.1</version>
    </dependency>

    <dependency>
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.18.1</version>
    </dependency>

    <dependency>
        <groupId>org.xhtmlrenderer</groupId>
        <artifactId>flying-saucer-core</artifactId>
        <version>9.1.22</version>
    </dependency>
    <dependency>
        <groupId>org.xhtmlrenderer</groupId>
        <artifactId>flying-saucer-pdf</artifactId>
        <version>9.1.22</version>
    </dependency>
    <dependency>
        <groupId>org.xhtmlrenderer</groupId>
        <artifactId>flying-saucer-pdf-openpdf</artifactId>
        <version>9.1.20</version>
    </dependency>
</dependencies>



<build>
    <plugins>
        <!-- Plugin for copying context.xml -->
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.2.0</version>
            <configuration>
                <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
                <resources>
                    <resource>
                        <directory>${basedir}/src/${profile}-resources</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
            </configuration>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <!-- here the phase you need -->
                    <phase>validate</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <!-- Plugin for packaging WAR file -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.3.1</version>
            <configuration>
                <warName>${project.artifactId}</warName>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <tasks>
                            <echo>**************************************************</echo>
                            <echo>[project.artifactId] ${project.artifactId}</echo>
                            <echo>[profile] ${profile}</echo>
                            <echo>${basedir}/src/main/resources/${profile}</echo>
                            <echo>${basedir}/src/main/resources/META-INF/context.xml</echo>
                            <echo>${project.build.directory}/${project.build.finalName}/META-INF</echo>
                            <echo></echo>
                            <echo>**************************************************</echo>
                        </tasks>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<profiles>
    <profile>
        <id>production</id>
        <properties>
            <profile>production</profile>
        </properties>
        <build>
            <finalName>${project.artifactId}</finalName>
        </build>
    </profile>
    <profile>
        <id>development</id>
        <properties>
            <profile>development</profile>
        </properties>
        <build>
            <finalName>${project.artifactId}</finalName>
        </build>
    </profile>
</profiles>
</project>

Solution

  • In some rare cases IDEA's caches may get corrupted during the upgrade, causing a mismatch between Maven's pom.xml and IDEA's internal Project Model. I would not necessarily recommend removing .idea folder, as it stores Project-specific settings (Run Configurations, etc.).

    Try the following, instead:

    1. Close all instances of IDEA

    2. Rename or remove the System Directory

    3. Re-import the Project: Open -> Navigate to the Project's directory -> Double-click the root pom.xml -> Open as Project