Bad Maven dependency version not flagged as red

已回答

I have a pom like this:

<properties>
  <some.version>1.2.3</some.version>
</properties>

<dependencyManagement>
<dependencies>
  <dependency>
<groupId>some.group.id</groupId>
<artifactId>the-name</artifactId>
<version>${misspelled-version-ie-non-existing}</version> <!-- should be red, right? -->
</dependency>

Shouldn't the version be flagged as an error? Have I done something to my configuration?

If I do the same mistake in a sub-module pom, it will get flagged as an error.

 

0

>If I do the same mistake in a sub-module pom, it will get flagged as an error.

Do you also have it under dependencyManagement section? The validation only happens (Inspections | Maven | Maven Model Inspection inspection) for dependencies which are really used in project (that are not included into dependencyManagement).

0

> Do you also have it under dependencyManagement section?

Yes, I use the dependency in a submodule. I don't declare the version in my submodule, just in the parent-pom "dependencyManagement" section.

So, in the master-pom under dependencyManagement, like code example in the question and in the submodule-pom as a "normal" dependency.

But even if the master-pom version is incorrect it is not red-flagged.

0

>> Do you also have it under dependencyManagement section?

>Yes,

it seems to me the above statement contradicts with:

>So, in the master-pom under dependencyManagement, like code example in the question and in the submodule-pom as a "normal" dependency.

 

Please clarify again: do you have the dependency which is highlighted as error under dependencyManagement section or not?

 

As mentioned:

The validation only happens (Inspections | Maven | Maven Model Inspection inspection) for dependencies which are really used in project (that are not included into dependencyManagement).

So if it is under dependencyManagement section it will not be highlighted.

0

Master pom.

<dependencyManagement>
<dependencies>
  <dependency>
<groupId>some.group.id</groupId>
<artifactId>the-name</artifactId>
<version>${misspelled-version-ie-non-existing}</version> <!-- should be red, right? -->
</dependency>
</dependencies>
</dependencyManagement>

In module pom 

<dependencies>
  <dependency>
<groupId>some.group.id</groupId>
<artifactId>the-name</artifactId>
</dependency>
</dependencies>

Are erroneous versions never flagged in the dependencyManagement-section? 

0

>Are erroneous versions never flagged in the dependencyManagement-section?

Yes, as noted in my first comment, they are never flagged. Feel free to file a request at https://youtrack.jetbrains.com/issues/IDEA.

0

请先登录再写评论。