maven-compiler-plugin not found
Asked Answered
P

13

14

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>
Pediment answered 7/2, 2020 at 20:26 Comment(9)
you can go to Maven Central and look for that dependency, I see it at: mvnrepository.com/artifact/org.apache.maven.plugins/…, so maybe you connected to a VPN ? or there is a repository configuration somewhere in your project ?, also will be more helpful if you post your entire pom.xml in a text snippetNiela
I am on VPN. How is it related to loading plugins?Brittan
maybe there is a HOST name resolution error, I've been into problems because of that like not finding some sites, had to change for Google DNS (8.8.8.8)Niela
Try cleaning/deleting your maven-compiler-plugin folder (and only that folder) in your local .m2Niela
Added pom.xml ...Brittan
I just compiled it with mvn and is just working fine: [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @stackoverflow-maven-compiler-plugin-errorNiela
After target in target folder it is ok. Thanks.Brittan
Please try to build your project on plain command line and safe the logging output ...that might help more.Racy
@AlexAndrade 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/…Variform
P
13

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>
Pacemaker answered 6/4, 2021 at 6:53 Comment(1)
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/…Variform
K
9

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>
...
Kilkenny answered 24/6, 2021 at 13:40 Comment(1)
i missed version. mvnrepository.com/artifact/org.apache.maven.plugins/…Customable
Q
8

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>
    ...
Quacksalver answered 6/12, 2021 at 10:19 Comment(0)
S
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

Sturges answered 29/6, 2021 at 7:53 Comment(0)
S
4

I got this error with IntelliJ. tried many ways, the below worked for me:

  1. Close your IDE.
  2. Delete "*.iml" and ".idea" -directories(present in the root folder of project)
  3. Run "mvn clean install" from the command-line
  4. Re-import your project into IDEA
Stearin answered 14/7, 2021 at 22:7 Comment(0)
O
3

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

Osei answered 14/4, 2020 at 16:40 Comment(0)
S
2

In my case, invalidating cache and restarting solved the issue.

Seasoning answered 29/9, 2020 at 8:55 Comment(0)
P
2

I went to

.m2\repository\org\apache\maven\plugins\maven-compiler-plugin

and removed older version. It worked

Pawn answered 29/4, 2022 at 0:18 Comment(0)
N
1

Add the Following code in your pom the issue will resolve

 <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M1</version>
            <configuration>
                <useSystemClassLoader>false</useSystemClassLoader>
                <forkCount>1</forkCount>
                <useFile>false</useFile>
                <skipTests>false</skipTests>
                <testFailureIgnore>true</testFailureIgnore>
                <forkMode>once</forkMode>
                <suiteXmlFiles>
                    <suiteXmlFile>testing.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>
    </plugins>
</build>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Make sure you are reimporting your dependency after adding plugins

Nordau answered 10/2, 2021 at 12:57 Comment(0)
L
0

You need to update your project so that the dependencies are updated from Maven side.

To update:

  1. Change the file structure to project view.
  2. Right click on project name -> Maven -> Reload project

And it will download all the necessary dependencies.

Laws answered 10/2, 2021 at 12:48 Comment(0)
E
0

One reason could be due to proxy setup on your system in Maven settings.

You can remove/backup the previous maven settings.xml file and this should work.

mv ~/.m2/settings.xml ~/.m2/settings.xml.bak
Erotomania answered 26/12, 2022 at 8:37 Comment(0)
G
0

For me I was also facing this suddenly, I just did maven clean install. It worked for me!!!

Govan answered 1/3, 2024 at 12:50 Comment(0)
T
0
<dependency>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.8.1</version>
</dependency>

This answer works for me.

Ted answered 9/7, 2024 at 6:28 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.