Eclipse chokes on enum, even though Compiler compliance level is 1.6 - java

I have set my Eclipse project's Compiler compliance level to 1.6
But I get errors like in the screenshot below: Syntax error, annotations are only available if source level is 1.5.
I have refreshed/cleaned/restarted Eclipse at least 10 times.
It compiles fine with Maven2. The Eclipse project has been generated by Maven2.
The project uses java-6-openjdk

Other solution:
1) Set Workspace JRE to 1.5 (and apply/save). Projects will rebuild.
2) Set Workspace JRE back to 1.6 (and apply/save). Projects will rebuild.
All errors are then gone.

Deleting the Eclipse project and re-importing it solved the problem.

Uncheck Enable project specific settings , click apply. Eclipse will ask for a build , click ok . Errors will be gone after the build .
Also , add the following in your pom.xml
`<properties>
<jdk.version>1.8</jdk.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>
`

Related

Cannot resolve plugin org.apache.maven.plugins:maven in IntelliJ [duplicate]

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

Change Java Version from 1.8 to 1.6 in maven project in intellij [duplicate]

I'm new to both Maven and IntelliJ IDEA.
I have a Maven project written in Java 8. Whenever I try to build it (Maven Projects window -> Lifecycle -> compile -> Run Maven Build) I get a series of compilation errors:
[ERROR] path/to/file.java:[26,52] lambda expressions are not supported in -source 1.5
(use -source 8 or higher to enable lambda expressions)
Where am I supposed to change the value of the -source parameter? I tried adding it as an additional parameter in Settings -> Compiler - > Java Compiler, but I got the same results.
The project's and module's language levels are both set to 8.0.
I'm using Maven 3.2.3 and IntelliJ IDEA Community Edition 13.1.2.
Or easier, add this to your pom's properties section:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
I don't think any response to the question addressed the concern - ". . . in IntelliJ".
Here are the steps: -
Go to Preference(or Settings) in IntelliJ ( or Shortcut on Mac ⌘ + ,)
Build, Execution, Deployment > Build Tools > Maven > Importing - select the "JDK for Importer" dropdown then select your preferred java version, Click Apply
Build, Execution, Deployment > Maven > Runner - select the "JRE" dropdown then select your preferred java version, Click Apply
Click OK
Summary:
'maven-compiler-plugin' ALWAYS work! It is what I suggest you to use.
To change the language level, make usage of
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
</plugins>
</build>
The properties do not always change the language level of Intellij!
In the code below, 1.4 was configured in the pom using maven-compiler-plugin
(the jdk of Intellij is 1.8) and the language level of the project was changed accordingly to 1.4:
It was double-checked! It is an example. Most of the time you will not downgrade the version of the JDK to 1.4!
Of course if you use properties, let's say you put in the pom 1.8, then if you use a 1.8 JDK in Intellij(the language level default is 1.8 or the language default was changed manually), then you will be able to code in 1.8 BUT at the mvn compile, the properties will NOT be seen and you will default to Maven 1.5 and the compilation will NOT succeed !
Change the source as shown below in pom.xml
<build>
<finalName>MQService</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Adding below lines to root(project level) pom.xml worked me to resolve above issue: (both of the options worked for me)
Option 1:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Option 2:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
originally posted at: IntelliJ IDEA 13 uses Java 1.5 despite setting to 1.7
It may sometimes happen that after configuring maven in Intellij and changing as following it does not work by command build, so build it by Intellij maven tool.
Setting > Maven > Importer - select the `JDK`
Setting > Maven > Runner - select the `JRE`
After that, try to build by Intellij maven tool instead of Intellij console.
There are two ways of doing this :
First- Add Properties
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
second- Add Plugin
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
Here are the steps for intellij version# 2021.2 Ultimate Edition: -
Go to Settings in IntelliJ
Build, Execution, Deployment > Build Tools > Maven > importing > "JDK for Importer" then select your preferred java version, Click Apply
Build, Execution, Deployment > Build Tools > Maven > Runner > For "JRE" option select your preferred java version,
Click Apply
Click OK
You should add below code in your pom.xml to force the language level to change
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
now intelliJ 2019.3 CE does this for you if you go to import then alt+enter where you will get an option saying "change language level to 8 to use this functionality"
open the ubuntu terminal goto your root directory and type:
export JAVA_HOME = <path to jdk>
for example, it works fine for me {do the same in IntelliJ terminal}.
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
to check the set value type echo $JAVA_HOME
to check the maven version type: mvn -version
you can find all path of JDKs by typing this command, and you can set JDK version.
sudo update-alternatives --config java
also check you have same java -version and javac -version.
You can click on the maven view in the extreme right, then Lifecycle -> right click on install and Modify Run Configuration:
Then expand Java Options, disable Inherit from settings and select your desired Java version.

java.util.Map$Entry class file not found

I recently updated Java to jre1.8.0_31 and Eclipse no longer will build my project. It fails with a message that java.util.Map$Entry class file cannot be found.
java.util.Map$Entry is a standard class in the JDK. In some circumstances it is in a file called rt.jar beneath JAVA_HOME but you should never have to add it yourself.
I am surprised that this is the only thing that is missing for you, there should be lots of other things missing too.
You should verify that your JDK is set up correctly under your preferences, and your project build path.
It's almost certain that the location of your JDK changed and Eclipse needs to be informed of this.
Also clean your project (right-click on top folder in project view, select 'clean'). Might be some stale files hanging around.
Actually, reviewing your question one final thing comes to mind, you say you updated your JRE. This is not the same thing as a JDK. You should install the 1.8 JDK also.
I was facing same issue, below solution worked for me
add below dependency in parent pom file
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7</version> <!-- 1.5 dint work for me -->
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.6</version>
</plugin>

Maven plugins can not be found in IntelliJ

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

Eclipse JRE System Library [J2SE-1.5]

I'm using Eclipse EE 3.7 with m2e plugin installed. I have JDK7 set in eclipse.
When I import maven projects, the JRE is set to JRE System Library [J2SE-1.5], So i have compilation issues with java 6 related stuff. Instead I want the JRE in eclipse to be by default set to JRE System Library [J2SE-1.6]
When i try to open a new project in eclipse File -> new -> Java project on the first screen i have an option to choose JRE and the third option is Use default JRE (currently 'jdk1.7.0_03')
From this i can see that the default JRE in Eclipse is 1.7, but when i import new Maven projects, the JRE is set to 1.5 by default.
Any help, how can i do this?
The problem is not with Eclipse, but with the projects you're importing. m2e will set the project's JRE to match the maven project. The POM specifies the JRE version, and this is defaulted to 1.5 if not present. You need this in the POM:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
artbristol gave the correct answer (and I upvoted him).
That was in 2012. Here is an update more appropriate for today (2016, Java 8, Spring 4.x/Servlet 3.x):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
The root cause of this issue is Eclipse cannot resolve a valid value for the maven.compiler.source property when updating the .classpath file from the pom, it is simply using default one i.e
org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5.
Just Add following properties into you pom.xml and update project:
<properties>
<javaVersion>1.8</javaVersion>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
You can have your brand new Maven project in Eclipse have JRE System Library version other than JavaSE-1.5. For that,find below jar in the following location.
File: maven-compiler-plugin-3.1.jar
Location:
.m2\repository\org\apache\maven\plugins\maven-compiler-plugin\3.1
Then unzip the jar and locate "META-INF\maven\plugin.xml" which has four occurrences of default-value="1.5". Replace all four 1.5 with 1.8 or whatever the version you want. You would know the rest of the process.
Reference

Categories

Resources