maven-compiler-plugin not found

30,537

Solution 1

In my case, I have changed the tags from plugin to dependency like it is in the Maven Repository.

<dependency>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.8.1</version>
</dependency>

Solution 2

In my case the groupId for the plugin was missing:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.8.0</version>
...

Solution 3

In my case, Spring Boot code works fine without changing anything, however, it gives the same error when I tried to commit in Git.

To solve this, I add the version info as follows and it worked.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${maven-compiler-plugin.version}</version>
    ...

Solution 4

I've faced this issue with my old project (which was 100% working on my old ItelliJ IDEA) and newly installed ItelliJ IDEA: in the pom.xml I had this:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
    </plugins>
</build>

And IDEA throwed an error maven-compiler-plugin not found. I've added

<groupId>org.apache.maven.plugins</groupId>

and IDEA found the plugin, and after that I was free to remove org.apache.maven.plugins without breaking IDEA

Solution 5

In IntelliJ you can right click on 3.8.1 scroll down to Maven and select "Reimport". This solved the issue for me.

Share:
30,537
Čamo
Author by

Čamo

Updated on December 07, 2021

Comments

  • Čamo
    Čamo over 2 years

    I am learning Selenium and I would like to try add the maven-compiler-plugin to pom.xml and reimport maven settings. So I found this example to do it http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html and tried to add the code to the pom.xml. But the vrsion from the example 3.8.1 is red like on the screenshot. What it means? It is a copy from example.

    enter image description here

    Here is the whole pom.xml

    <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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>camaj.vladimir</groupId>
        <artifactId>selenium-maven</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
                <version>3.141.59</version>
            </dependency>
            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-server</artifactId>
                <version>3.141.59</version>
            </dependency>
            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-chrome-driver</artifactId>
                <version>3.141.59</version>
            </dependency>
            <dependency>
                <groupId>org.apache.poi</groupId>
                <artifactId>poi-ooxml</artifactId>
                <version>4.1.1</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.tempus-fugit</groupId>
                <artifactId>tempus-fugit</artifactId>
                <version>1.1</version>
            </dependency>
            <dependency>
                <groupId>com.codeborne</groupId>
                <artifactId>phantomjsdriver</artifactId>
                <version>1.4.4</version>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
    
  • julian-alarcon
    julian-alarcon over 2 years
    That's not official maven Central Repository Database, that's a third party. The official is search.maven.org search.maven.org/artifact/org.apache.maven.plugins/…