Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New-added Maven plugin becomes red in IntelliJ

I'm following this guideline for a Maven plugin, after which I've added the following:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <version>2.5.3</version>
</plugin>

maven-release-plugin & 2.5.3 are both red. I'm using a local Maven repository. How can I update it? Do I need to install anything so that IntelliJ can find it? I'm new to Maven and would appreciate being pointed in the right direction.

like image 226
wawawa Avatar asked Nov 19 '19 16:11

wawawa


People also ask

Why are my Maven dependencies red?

It looks like some connection issue, Maven is not able to download the dependencies from the repository. Make sure Internet connection is available and your antivirus/firewall is not blocking the downloads. Try running mvn clean package in the command line to ensure that it completes without any errors.

Why Maven is not working in IntelliJ?

Maven dependencies imported incorrectly If the dependencies weren't imported correctly (IntelliJ IDEA highlights them), try to perform the following actions: You can check your local maven repository in the Maven | Repositories settings and try to update it. You can check the jar file of the local .


2 Answers

You have to add the following in Maven pom.xml.

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
      </plugin>
    </plugins>
  </build>

Once added , wait for 2 mins in Intellij Idea based upon the network speed. Still does not work, click on the right side of Intellij Idea having a tab "Maven" and click refresh button. See the picture below.

enter image description here

like image 180
PythonLearner Avatar answered Oct 29 '22 06:10

PythonLearner


Double-check your IntelliJ maven configuration at File->Settings->Build, Execution, Deployment->Build Tools->Maven

  1. Work Offline is not checked
  2. Your local repository is correct

enter image description here

Double-check your local repository folder usually at %HOMEPATH%\.m2\repository\ and go through the subfolders org\apache\maven\plugins\maven-release-plugin if you do not find a jar file the dependency was not downloaded.

You can try to force maven to download the missing dependencies. Navigate to your project pom.xml file and run the following command:

mvn -U -X dependency:copy-dependencies

The -U force the update and -X produce a debug log with more information about what is going wrong.

If you have a file %HOMEPATH%\.m2\setting.xml check the content and see if there is any proxy information. You can try to rename this file and force the update again.

You can also install dependency manually Download the jar and try the command:

    mvn install:install-file -Dfile=<path-to-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-release-plugin -Dversion=2.5.3 
like image 1
Edu Costa Avatar answered Oct 29 '22 06:10

Edu Costa