Related
After updating IntelliJ from version 12 to 13, the following Maven-related plugins cannot be resolved:
org.apache.maven.plugins:maven-clean-plugin:2.4.1
org.apache.maven.plugins:maven-deploy-plugin
org.apache.maven.plugins:maven-install-plugin
org.apache.maven.plugins:maven-site-plugin
When using IntelliJ 12, these were not in the plugins list. Somehow they've been added after the update and now IntelliJ complains they cannot be found. Where can I remove these plugins from the list OR resolve the problem by installing them?
I can run maven goals clean and compile without problem, but the profile/plugins appear red with warnings in the IDE.
EDIT after 8 years: Please also have a look at all other good answers here. The accepted answer is a common solution but might not work for you or for your IDE version
For newer versions of IntelliJ, enable the use plugin registry option within the Maven settings as follows:
Click File π‘ Settings.
Expand Build, Execution, Deployment π‘ Build Tools π‘ Maven.
Check Use plugin registry.
Click OK or Apply.
For IntelliJ 14.0.1, open the preferences---not settings---to find the plugin registry option:
Click File π‘ Preferences.
Regardless of version, also invalidate the caches:
Click File π‘ Invalidate Caches / Restart.
Click Invalidate and Restart.
When IntelliJ starts again the problem should be vanquished.
Run a Force re-import from the maven tool window. If that does not work, Invalidate your caches (File > Invalidate caches) and restart. Wait for IDEA to re-index the project.
I had this problem for years with the maven-deploy plugin, and the error showed up even though I was not directly including the plugin in my POM. As a work-around I had to force include the plugin with a version into my POMs plugin section just to remove the red-squiggly.
After trying every solution on Stack Overflow, I found the problem: Looking into my .m2/repository/org/apache/maven/plugins/maven-deploy-plugin directory there was a version 'X.Y' along with '2.8.2' et al. So I deleted the entire maven-deploy-plugin directory, and then re-imported my Maven project.
So it seems the issue is an IntelliJ bug in parsing the repository. I would not not remove the entire repository though, just the plugins that report an error.
None of the other answers worked for me. The solution that worked for me was to download the missing artifact manually via cmd:
mvn dependency:get -DrepoUrl=http://repo.maven.apache.org/maven2/ -Dartifact=ro.isdc.wro4j:wro4j-maven-plugin:1.8.0
After this change need to let know the Idea about new available artifacts. This can be done in "Settings > Maven > Repositories", select there your "Local" and simply click "Update".
Edit: the -DrepoUrl seems to be deprecated. -DremoteRepositories should be used instead. Source: Apache Maven Dependency Plugin β dependency:get.
The red with warnings maven-site-plugin resolved after the build site Lifecycle:
My IntelliJ version is Community 2017.2.4
SOLVED !!!
This is how I fixed the issue...
Tried one of the answers which include 'could solve it by enabling "use plugin registry" '. Did enable that but no luck.
Tried again one of the answers in the thread which says 'If that does not work, Invalidate your caches (File > Invalidate caches) and restart.' Did that but again no luck.
Tried These options ..
Go to Settings --> Maven --> Importing and made sure the following was selected
Import Maven projects automatically
Create IDEA modules for aggregator projects Keep source...
Exclude build dir...
Use Maven output...
Generated souces folders: "detect automatically"
Phase to be...: "process-resources"
Automatically download: "sources" & "documentation"
Use Maven3 to import
project VM options for importer: -Xmx512m
But again no success.
Now lets say I had 10 such plugins which didn't get resolve and among them the
first was 'org.apache.maven.plugins:maven-site-plugin'
I went to '.m2/repository/org/apache/maven/plugins/' and deleted the directory
'maven-site-plugin' and did a maven reimport again. Guess what, particular
missing plugin got dowloaded. And I just followed similar steps for other
missing plugins and all got resolved.
I had the same issue. I added the plugins into my pom.xml dependencies and it works for me.
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<type>maven-plugin</type>
</dependency>
I tried the other answers, but none of them solved this problem for me.
The problem disappeared when I explicitly added the groupId like this:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
Once the color of the version number changed from red to black and the problem disappeared from the Problems tab the groupId can be removed again from the problematic plugin, the error does not show up again and the version number even shows up as suggestion for version.
I am using IntelliJ Ultimate 2018.2.6 and found out, that the feature Reimport All Maven Project does not use the JDK, which is set in the Settings: Build, Execution, Deployment | Build Tools | Maven | Runner.
Instead it uses it's own JRE in IntelliJ_HOME/jre64/ by default. You can configure the JDK for the Importer in Build, Execution, Deployment | Build Tools | Maven | Importing.
In my specific problem, an SSL certificate was missing in the JREs keystore. Unfortunately IDEA only logs this issue in it's own logfile. A little red box to inform about the RuntimeException had been really nice...
I had the same error and was able to get rid of it by deleting my old Maven settings file. Then I updated the Maven plugins manually using the mvn command:
mv ~/.m2/settings.xml ~/.m2/settings.xml.old
mvn -up
Finally I ran the "Reimport All Maven Projects" button in the Maven Project tab in IntelliJ. The errors vanished in my case.
None of the other solutions worked for me.
My solution:
Maven Settings -> Repositories -> select Local Repository in the list, Update
Worked like a charm!
This did the trick for me...delete all folders and files under 'C:\Users[Windows User Account].m2\repository'.
Finally ran 'Reimport All Maven Projects' in the Maven Project tab in IntelliJ.
Remove your local Maven unknown plugin and reimport all maven projects. This will fix this issue.
You can find it under View > Tool Windows > Maven :
For me it was as simple as giving the plugin a version:
<version>3.3.0</version>
The full plugin code sample is given below:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
I was recently faced with the same issue. None of the other solutions resolved the red error lines.
What I did was run the actual targets in question (deploy, site). I could see those dependencies then being fetched.
After that, a reimport did the trick.
If an artifact is not resolvable.
Go in the directory of your .m2/repository
and check that you DON'T have that kind of file :
build-helper-maven-plugin-1.10.pom.lastUpdated
If you don't have any artefact in the folder, just delete it, and try again to re-import in IntelliJ.
the content of those files is like :
#NOTE: This is an Another internal implementation file, its format can be changed without prior notice.
#Fri Mar 10 10:36:12 CET 2017
#default-central-https\://repo.maven.apache.org/maven2/.lastUpdated=1489138572430
https\://repo.maven.apache.org/maven2/.error=Could not transfer artifact org.codehaus.mojo\:build-helper-maven-plugin\:pom\:1.10 from/to central (https\://repo.maven.apache.org/maven2)\: connect timed out
Without the *.lastUpdated file, IntelliJ (or Eclipse by the way) is enabled to reload what is missing.
I could solve this problem by changing "Maven home directory" from "Bundled (Maven 3) to "/usr/local/Cellar/maven/3.2.5/libexec" in the maven settings of IntelliJ (14.1.2).
Uncheck the "Work offline" checkbox in Maven settings.
Here is what I tried to fix the issue and it worked:
Manually deleted the existing plugin from the .m2 repo
Enabled "use plugin registry" in IntelliJ
Invalidated the cache and restarted IntelliJ
Reimported the maven project in IntelliJ
After following above steps, the issue was fixed. Hopefully this helps you as well.
For me which worked is putting the repository which contained the plugin under pluginRepository tags. Example,
<pluginRepositories>
<pluginRepository>
<id>pcentral</id>
<name>pcentral</name>
<url>https://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
Enabling "use plugin registry" and Restart project after invalidate cash solved my problem
to Enabling "use plugin registry" >>> (intelij) File > Setting > Maven > enable the option from the option list of maven
To invalidate cash >>> file > invalidate cash
That's it...
This worked for me
Go to Settings --> Maven --> Importing --> JDK for importer -->
use "Use Project JDK" option instead of a custom JDK set previously.
Re-build/re-import all the dependencies.
This worked for me:
Close IDEA
Delete "*.iml" and ".idea" -directories(present in the root folder of project)
Run "mvn clean install" from the command-line
Re-import your project into IDEA
After re-importing the entire project, installation of dependencies will start which will take some minutes to complete depending upon your internet connection.
My case:
maven-javadoc-plugin with version 3.2.0 is displayed red in IntelliJ.
Plugin is present in my local maven repo.
Re-imported maven million times.
Ran mvn clean install from the command line N times.
All my maven settings in IntelliJ are correct.
Tried to switch between Bundled and non-bundled Maven.
Tried do delete the whole maven repo and to delete only the plugin from it.
Nothing of the above worked.
The only thing that almost always helps with modern IntelliJ IDEA versions is "Invalidate caches / Restart". It helped this time as well. maven-javadoc-plugin is not red anymore, and I can click on it and to to the source pom file of the plugin.
Recently I faced the same issue.
All tips doesn't work in my cause.
But I fix it.
Go to Intellij idea setting, find Maven, and in it you need to open Repository tab and update maven and local repos. That's all.
If you have red squiggles underneath the project in the Maven plugin, try clicking the "Reimport All Maven Projects" button (looks like a refresh symbol).
Check the plugins which cannot be found (maven-site-plugin,maven-resources-plugin)
go to '.m2/repository/org/apache/maven/plugins/'
delete the directory rm -rf plugin-directory-name (eg: rm -rf maven-site-plugin)
exit project from intellij
import project again
Do a Maven reimport
Explanation: when you do a maven reimport, it will download all the missing plugins again.
Happy Coding
I use the community edition packaged as snap on Ubuntu 18.04.
I experience that issue each time there a IntelliJ release.
In that scenario, my working solution is to invoke the invalidate cache and restart from the file menΓΉ flagging the indexes removal too.
June/2021:
No Delete, No Reimport.
What I did is, I was going to :
C:\Users\dell\.m2\repository\org\apache\maven\plugins
Then double Click on every Plugin Folders, And see what version it is downloaded.
Then I came back to pom file, and according to downloaded version, I carefully changes those versions in <version>....</version> Tags. Then refresh.
And That way, All red marks are gone, Even gone those Yellow Marks.
All Clean.
Here is my full pom file for further notice. The Project is JavaFx+Maven with Shade :
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>main.java.sample</groupId>
<artifactId>ThreeColumnTable</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>resources</goal>
<goal>testResources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/generated-groovy-stubs</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>org.example.App</mainClass>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.1</version>
<configuration>
<mainClass>org.example.App</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>project-classifier</shadedClassifierName>
<transformers>
<transformer implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.example.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Goto IntelliJ -> Preferences -> Plugin
Search for maven, you will see
1. Maven Integration
2. Maven Integration Extension.
Select the Maven Integration option and restart your Intellij
I am trying to build a Hudson plugin I've modified and it requires jdk1.6. This is fine, but I don't see how I can tell maven where the different jdk is. I've found few mentions on the internet but they don't seem to apply to me. Some suggest adding some config to .m2/settings.xml but I don't have a settings.xml. Plus, I don't want to use 1.6 for all maven builds.
One kink is I am using mvn in cygwin, if that matters at all. It appears I should be able to make the specification in the project pom file, but the existing pom is pretty bare.
So bottom line is, is there a way to specify a jdk for a single invocation of maven?
So bottom line is, is there a way to specify a jdk for a single invocation of maven?
Temporarily change the value of your JAVA_HOME environment variable.
Seems that maven now gives a solution here : Compiling Sources Using A Different JDK
Let's say your JAVA_HOME points to JDK7 (which will run maven processes)
Your pom.xml could be :
<build>
<plugins>
<!-- we want JDK 1.6 source and binary compatiblility -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- ... -->
<!-- we want sources to be processed by a specific 1.6 javac -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>${JAVA_1_6_HOME}/bin/javac</executable>
<compilerVersion>1.3</compilerVersion>
</configuration>
</plugin>
</plugins>
</build>
If your developpers just add (and customize) the following lines in their settings.xml, your pom will be platform independant :
<settings>
[...]
<profiles>
[...]
<profile>
<id>compiler</id>
<properties>
<JAVA_1_4_HOME>C:\Program Files\Java\j2sdk1.4.2_09</JAVA_1_4_HOME>
<JAVA_1_6_HOME>C:\Program Files\Java\j2sdk1.6.0_18</JAVA_1_6_HOME>
</properties>
</profile>
</profiles>
[...]
<activeProfiles>
<activeProfile>compiler</activeProfile>
</activeProfiles>
</settings>
compile:compile has a user property that allows you to specify a path to the javac.
Note that this user property only works when fork is true which is false by default.
$ mvn -Dmaven.compiler.fork=true -Dmaven.compiler.executable=/path/to/the/javac compile
You might have to double quote the value if it contains spaces.
> mvn -Dmaven.compiler.fork=true -Dmaven.compiler.executable="C:\...\javac" compile
See also Maven custom properties precedence.
As u said "Plus, I don't want to use 1.6 for all maven builds."....So better I will say modify your pom file and specify which jdk version to use.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.9</source>
<target>1.9</target>
</configuration>
</plugin>
</plugins>
</build>
It will ensure that your particular project uses that version of jdk.
I say you setup the JAVA_HOME environment variable like Pascal is saying:
In Cygwin if you use bash as your shell should be:
export JAVA_HOME=/cygdrive/c/pathtothejdk
It never harms to also prepend the java bin directory path to the PATH environment variable with:
export PATH=${JAVA_HOME}/bin:${PATH}
Also add maven-enforce-plugin to make sure the right JDK is used. This is a good practice for your pom.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>1.6</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Please, see Maven Enforcer plugin β Usage.
If you have installed Java through brew in Mac then chances are you will find your Java Home Directory here:
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
The next step now would be to find which Java Home directory maven is pointing to. To find it type in the command:
mvn -version
The fields we are interested in here is:
Java version and runtime.
Maven is currently pointing to Java 13. Also, you can see the Java Home path under the key runtime, which is:
/usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home
To change the Java version of the maven, we need to add the Java 8 home path to the JAVA_HOME env variable.
To do that we need to run the command:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
in the terminal.
Now if we check the maven version, we can see that it is pointing to Java 8 now.
The problem with this is if you check the maven version again in the new terminal, you will find that it is pointing to the Java 13. To avoid this I would suggest adding the JAVA_HOME variable in the ~/.profile file.
This way whenever your terminal is loading it will take up the value you defined in the JAVA_HOME by default. This is the line you need to add in the ~/.profile file:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
You can open up a new terminal and check the Maven version, (mvn -version) and you will find it is pointing to the Java 8 this time.
I know its an old thread. But I was having some issues with something similar to this in Maven for Java 8 compiler source. I figured this out with a quick fix mentioned in this article thought I can put it here and maybe can help others:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Maven uses variable $JAVACMD as the final java command, set it to where the java executable is will switch maven to different JDK.
You could also set the JDK for Maven in a file in your home directory ~/.mavenrc:
JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home'
This environment variable will be checked by the mvn script and used when present:
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
https://github.com/CodeFX-org/mvn-java-9/tree/master/mavenrc
Hudson also allows you to define several Java runtimes, and let you invoke Maven with one of these. Have a closer look on the configuration page.
Yet another alternative to manage multiple jdk versions is jEnv
After installation, you can simply change java version "locally" i.e. for a specific project directory by:
jenv local 1.6
This will also make mvn use that version locally, when you enable the mvn plugin:
jenv enable-plugin maven
I update my ~/.m2/settings.xml
<settings>
<profiles>
<profile>
<id>j8</id>
<profile>
<id>j8</id>
<properties>
<maven.compiler.fork>true</maven.compiler.fork>
<maven.compiler.executable>${env.JAVA_HOME8}/bin/javac.exe</maven.compiler.executable>
</properties>
</profile>
<profile>
<id>j11</id>
<properties>
<maven.compiler.fork>true</maven.compiler.fork>
<maven.compiler.executable>${env.JAVA_HOME11}/bin/javac.exe</maven.compiler.executable>
</properties>
</profile>
</profiles>
<settings>
For build with Java8 I run mvn with properties:
mvn compile -Pj8
and for Java 11
mvn compile -Pj11
If nothing else works and even after you set JAVA_HOME to a correct path, check if there is no override of the JAVA_HOME path in <user>/.mavenrc!
As a further tip, the mvn file is a bash script (on Linux).. so if necessary you can inspect the source [and change it].
I had build problem with maven within Eclipse on Windows 7.
Though I observed mvn build was running just fine from command line.
mvn -T 5 -B -e -X -U -P test clean install -Dmaven.surefire.debug --settings ..\..\infra-scripts\maven-conf\settings.xml > output.log
Eclipse was considering as default JVM a JRE installation instead of JDK so it was failing on compilation.
I added to eclipse.ini following line:
-vm
C:\Program Files (x86)\Java\jdk1.8.0_25\bin
Also when starting from eclipse I used in "Goals" section following list:
-T 5 -B -e -X -U -P test clean install -Dmaven.surefire.debug --settings ..\..\infra-scripts\maven-conf\settings.xml
Compilation error got solved.
For Java 9 :
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
</plugins>
</build>
After updating IntelliJ from version 12 to 13, the following Maven-related plugins cannot be resolved:
org.apache.maven.plugins:maven-clean-plugin:2.4.1
org.apache.maven.plugins:maven-deploy-plugin
org.apache.maven.plugins:maven-install-plugin
org.apache.maven.plugins:maven-site-plugin
When using IntelliJ 12, these were not in the plugins list. Somehow they've been added after the update and now IntelliJ complains they cannot be found. Where can I remove these plugins from the list OR resolve the problem by installing them?
I can run maven goals clean and compile without problem, but the profile/plugins appear red with warnings in the IDE.
EDIT after 8 years: Please also have a look at all other good answers here. The accepted answer is a common solution but might not work for you or for your IDE version
For newer versions of IntelliJ, enable the use plugin registry option within the Maven settings as follows:
Click File π‘ Settings.
Expand Build, Execution, Deployment π‘ Build Tools π‘ Maven.
Check Use plugin registry.
Click OK or Apply.
For IntelliJ 14.0.1, open the preferences---not settings---to find the plugin registry option:
Click File π‘ Preferences.
Regardless of version, also invalidate the caches:
Click File π‘ Invalidate Caches / Restart.
Click Invalidate and Restart.
When IntelliJ starts again the problem should be vanquished.
Run a Force re-import from the maven tool window. If that does not work, Invalidate your caches (File > Invalidate caches) and restart. Wait for IDEA to re-index the project.
I had this problem for years with the maven-deploy plugin, and the error showed up even though I was not directly including the plugin in my POM. As a work-around I had to force include the plugin with a version into my POMs plugin section just to remove the red-squiggly.
After trying every solution on Stack Overflow, I found the problem: Looking into my .m2/repository/org/apache/maven/plugins/maven-deploy-plugin directory there was a version 'X.Y' along with '2.8.2' et al. So I deleted the entire maven-deploy-plugin directory, and then re-imported my Maven project.
So it seems the issue is an IntelliJ bug in parsing the repository. I would not not remove the entire repository though, just the plugins that report an error.
None of the other answers worked for me. The solution that worked for me was to download the missing artifact manually via cmd:
mvn dependency:get -DrepoUrl=http://repo.maven.apache.org/maven2/ -Dartifact=ro.isdc.wro4j:wro4j-maven-plugin:1.8.0
After this change need to let know the Idea about new available artifacts. This can be done in "Settings > Maven > Repositories", select there your "Local" and simply click "Update".
Edit: the -DrepoUrl seems to be deprecated. -DremoteRepositories should be used instead. Source: Apache Maven Dependency Plugin β dependency:get.
The red with warnings maven-site-plugin resolved after the build site Lifecycle:
My IntelliJ version is Community 2017.2.4
SOLVED !!!
This is how I fixed the issue...
Tried one of the answers which include 'could solve it by enabling "use plugin registry" '. Did enable that but no luck.
Tried again one of the answers in the thread which says 'If that does not work, Invalidate your caches (File > Invalidate caches) and restart.' Did that but again no luck.
Tried These options ..
Go to Settings --> Maven --> Importing and made sure the following was selected
Import Maven projects automatically
Create IDEA modules for aggregator projects Keep source...
Exclude build dir...
Use Maven output...
Generated souces folders: "detect automatically"
Phase to be...: "process-resources"
Automatically download: "sources" & "documentation"
Use Maven3 to import
project VM options for importer: -Xmx512m
But again no success.
Now lets say I had 10 such plugins which didn't get resolve and among them the
first was 'org.apache.maven.plugins:maven-site-plugin'
I went to '.m2/repository/org/apache/maven/plugins/' and deleted the directory
'maven-site-plugin' and did a maven reimport again. Guess what, particular
missing plugin got dowloaded. And I just followed similar steps for other
missing plugins and all got resolved.
I had the same issue. I added the plugins into my pom.xml dependencies and it works for me.
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<type>maven-plugin</type>
</dependency>
I tried the other answers, but none of them solved this problem for me.
The problem disappeared when I explicitly added the groupId like this:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
Once the color of the version number changed from red to black and the problem disappeared from the Problems tab the groupId can be removed again from the problematic plugin, the error does not show up again and the version number even shows up as suggestion for version.
I am using IntelliJ Ultimate 2018.2.6 and found out, that the feature Reimport All Maven Project does not use the JDK, which is set in the Settings: Build, Execution, Deployment | Build Tools | Maven | Runner.
Instead it uses it's own JRE in IntelliJ_HOME/jre64/ by default. You can configure the JDK for the Importer in Build, Execution, Deployment | Build Tools | Maven | Importing.
In my specific problem, an SSL certificate was missing in the JREs keystore. Unfortunately IDEA only logs this issue in it's own logfile. A little red box to inform about the RuntimeException had been really nice...
I had the same error and was able to get rid of it by deleting my old Maven settings file. Then I updated the Maven plugins manually using the mvn command:
mv ~/.m2/settings.xml ~/.m2/settings.xml.old
mvn -up
Finally I ran the "Reimport All Maven Projects" button in the Maven Project tab in IntelliJ. The errors vanished in my case.
None of the other solutions worked for me.
My solution:
Maven Settings -> Repositories -> select Local Repository in the list, Update
Worked like a charm!
This did the trick for me...delete all folders and files under 'C:\Users[Windows User Account].m2\repository'.
Finally ran 'Reimport All Maven Projects' in the Maven Project tab in IntelliJ.
Remove your local Maven unknown plugin and reimport all maven projects. This will fix this issue.
You can find it under View > Tool Windows > Maven :
For me it was as simple as giving the plugin a version:
<version>3.3.0</version>
The full plugin code sample is given below:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
I was recently faced with the same issue. None of the other solutions resolved the red error lines.
What I did was run the actual targets in question (deploy, site). I could see those dependencies then being fetched.
After that, a reimport did the trick.
If an artifact is not resolvable.
Go in the directory of your .m2/repository
and check that you DON'T have that kind of file :
build-helper-maven-plugin-1.10.pom.lastUpdated
If you don't have any artefact in the folder, just delete it, and try again to re-import in IntelliJ.
the content of those files is like :
#NOTE: This is an Another internal implementation file, its format can be changed without prior notice.
#Fri Mar 10 10:36:12 CET 2017
#default-central-https\://repo.maven.apache.org/maven2/.lastUpdated=1489138572430
https\://repo.maven.apache.org/maven2/.error=Could not transfer artifact org.codehaus.mojo\:build-helper-maven-plugin\:pom\:1.10 from/to central (https\://repo.maven.apache.org/maven2)\: connect timed out
Without the *.lastUpdated file, IntelliJ (or Eclipse by the way) is enabled to reload what is missing.
I could solve this problem by changing "Maven home directory" from "Bundled (Maven 3) to "/usr/local/Cellar/maven/3.2.5/libexec" in the maven settings of IntelliJ (14.1.2).
Uncheck the "Work offline" checkbox in Maven settings.
Here is what I tried to fix the issue and it worked:
Manually deleted the existing plugin from the .m2 repo
Enabled "use plugin registry" in IntelliJ
Invalidated the cache and restarted IntelliJ
Reimported the maven project in IntelliJ
After following above steps, the issue was fixed. Hopefully this helps you as well.
For me which worked is putting the repository which contained the plugin under pluginRepository tags. Example,
<pluginRepositories>
<pluginRepository>
<id>pcentral</id>
<name>pcentral</name>
<url>https://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
Enabling "use plugin registry" and Restart project after invalidate cash solved my problem
to Enabling "use plugin registry" >>> (intelij) File > Setting > Maven > enable the option from the option list of maven
To invalidate cash >>> file > invalidate cash
That's it...
This worked for me
Go to Settings --> Maven --> Importing --> JDK for importer -->
use "Use Project JDK" option instead of a custom JDK set previously.
Re-build/re-import all the dependencies.
This worked for me:
Close IDEA
Delete "*.iml" and ".idea" -directories(present in the root folder of project)
Run "mvn clean install" from the command-line
Re-import your project into IDEA
After re-importing the entire project, installation of dependencies will start which will take some minutes to complete depending upon your internet connection.
My case:
maven-javadoc-plugin with version 3.2.0 is displayed red in IntelliJ.
Plugin is present in my local maven repo.
Re-imported maven million times.
Ran mvn clean install from the command line N times.
All my maven settings in IntelliJ are correct.
Tried to switch between Bundled and non-bundled Maven.
Tried do delete the whole maven repo and to delete only the plugin from it.
Nothing of the above worked.
The only thing that almost always helps with modern IntelliJ IDEA versions is "Invalidate caches / Restart". It helped this time as well. maven-javadoc-plugin is not red anymore, and I can click on it and to to the source pom file of the plugin.
Recently I faced the same issue.
All tips doesn't work in my cause.
But I fix it.
Go to Intellij idea setting, find Maven, and in it you need to open Repository tab and update maven and local repos. That's all.
If you have red squiggles underneath the project in the Maven plugin, try clicking the "Reimport All Maven Projects" button (looks like a refresh symbol).
Check the plugins which cannot be found (maven-site-plugin,maven-resources-plugin)
go to '.m2/repository/org/apache/maven/plugins/'
delete the directory rm -rf plugin-directory-name (eg: rm -rf maven-site-plugin)
exit project from intellij
import project again
Do a Maven reimport
Explanation: when you do a maven reimport, it will download all the missing plugins again.
Happy Coding
I use the community edition packaged as snap on Ubuntu 18.04.
I experience that issue each time there a IntelliJ release.
In that scenario, my working solution is to invoke the invalidate cache and restart from the file menΓΉ flagging the indexes removal too.
June/2021:
No Delete, No Reimport.
What I did is, I was going to :
C:\Users\dell\.m2\repository\org\apache\maven\plugins
Then double Click on every Plugin Folders, And see what version it is downloaded.
Then I came back to pom file, and according to downloaded version, I carefully changes those versions in <version>....</version> Tags. Then refresh.
And That way, All red marks are gone, Even gone those Yellow Marks.
All Clean.
Here is my full pom file for further notice. The Project is JavaFx+Maven with Shade :
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>main.java.sample</groupId>
<artifactId>ThreeColumnTable</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>resources</goal>
<goal>testResources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/generated-groovy-stubs</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>org.example.App</mainClass>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.1</version>
<configuration>
<mainClass>org.example.App</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>project-classifier</shadedClassifierName>
<transformers>
<transformer implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.example.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Goto IntelliJ -> Preferences -> Plugin
Search for maven, you will see
1. Maven Integration
2. Maven Integration Extension.
Select the Maven Integration option and restart your Intellij
I have a big Maven project that uses the PMD plugin for code quality checks.
since I started using the PMD plugin i get the following warning message:
[WARNING] Unable to locate Source XRef to link to - DISABLED
I googled and found that i need to implement the JXR plugin.
So I added the following to the main pom.xml file.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
It doesn't really change anything.
Any ideas what I need to change in order to resolve this warning message?
output of mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: /usr/share/maven-bin-3.0
Java version: 1.7.0_05, vendor: Oracle Corporation
Java home: /usr/lib64/icedtea7/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.5.2-gentoo", arch: "amd64", family: "unix"
thanks!
You should add the maven-jxr-plugin to the reportingPlugin section.
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</reporting>
Re run it and enjoy.
BTW, maybe you'll need to run once the jxr:jxr goal to first generate some file that will be used by pmd.
Mind there is also the ability to disable the xref feature by adding
<configuration>
<linkXRef>false</linkXRef>
</configuration>
to the maven-pmd-plugin plugin. This resolves the warning without making the build even longer due to running an additional reporting plugin. E.g. if you run your builds in Jenkins, the Jenkins PMD plugin can take care of relating PMD warnings to source code, there is no need to run another Maven plugin for this.
You should add the maven-jxr-plugin and run the jxr:jxr goal before the site lifecycle if the maven-jxr-plugin is added as a plugin like in your case:
clean jxr:jxr site
Otherwise you should add it as a report if you want it to work with mvn site. Take a look at the JXR Usage Documentation :
JXR Usage
It is way easier to configure it this way and not tie it to the site phase.
Then, it is as simple as mvn test.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<outputDirectory>target/surefire-reports</outputDirectory>
<linkXRef>false</linkXRef>
</configuration>
</plugin>
</plugins>
I have a maven project that uses some custom jars [not found in any repository]. To add them along with the Maven build I am using the attach-artifact goal in maven. Following is my pom file:
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.maximus</groupId>
<artifactId>adminbuild</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>adminbuild</name>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<outputDirectory>target</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${basedir}/../../resources/dependencies/java/customjar1.jar</file>
<type>jar</type>
</artifact>
<artifact>
<file>${basedir}/../../resources/dependencies/java/customjar2.jar</file>
<type>jar</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
My projects that use these jars [customjar1.jar, customjar2.jar] have their dependency on the above pom file [adminbuild].
When I execute the mvn clean install command, I get the following error:
[ERROR] Failed to execute goal org.codehaus.mojo:build-helper-maven-plugin:1.7:attach-artifact (attach-artifacts) on project adminbuild: The artifact with same type and classifier: jar:null is used more than once. -> [Help 1]
Following is the output of mvn -version command:
Apache Maven 3.0.3 (r1075438; 2011-02-28 23:01:09+0530)
Maven home: C:\maven
Java version: 1.6.0_26, vendor: Sun Microsystems Inc.
Java home: C:\Java\jdk1.6.0_26\jre
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
It seems that the way I am attaching the artifacts is incorrect. Should I not attach multiple artifacts in the same pom file? If yes then how. Please help.
Attached artifacts are normally used to install additional files created by your build, like the classes jar of a webapp, documentation or sources.
To add files to your maven repository so they are available as dependencies you should use the install-file goal.
Edit: Attached artifacts are identified by the same groupId and artifactId as your main project but with a different classifier. In your configuration, you did not specify the classifier, hence the error message.
You would want to have these custom jars in a repository manager like nexus so that they can be downloaded/used like a normal dependency jar.
Assuming that is not possible and seeing that these jars are in well-known location, perhaps you could specify these custom jars with system scope in the projects that need them?
<project>
...
<dependencies>
<dependency>
<groupId>my-group</groupId>
<artifactId>customjar1</artifactId>
<version>a.b.c</version>
<scope>system</scope>
<systemPath>${basedir}/../../resources/dependencies/java/customjar1.jar</systemPath>
</dependency>
</dependencies>
...
</project>
I used a secondary project to do this along with a multi-module.
https://stackoverflow.com/q/7908872/242042