I hesitate to blindly rename the local directory, for fear of then not being able to reduce this issue and get to the root of the problem.

Does no one on this list know what file or timestamp Maven Artifact Resolver looks at to determine if it should go out to Maven Central to request the latest versions rather than relying on the cached information?

Garret

On 5/24/2023 10:40 AM, Delany wrote:
Try renaming `C:\Users\user\.m2\repository\`
Does the issue persist?
Delany

On Wed, 24 May 2023, 18:04 Garret Wilson, <gar...@globalmentor.com> wrote:

I'm writing to this list on the advice of Andrzej Jarmoniuk on [Versions
Maven Plugin Issue
#959](https://github.com/mojohaus/versions/issues/959). I have also
opened a [Stack Overflow question](https://stackoverflow.com/q/76307809)
with a bounty, but so far there have been no responses.

In short Maven Artifact Resolver on my machine seems to be stuck at some
previous point in time; it does not see the latest versions on Maven
Central when I am requested updated plugin versions using Versions Maven
Plugin. It shows that there are newer versions available, but the ones
it shows are not the latest available. Before deleting my entire
`C:\Users\user\.m2\repository\` directory tree I would prefer to know
what is caused this scenario so that it won't happen again in the
future. But at the moment I don't even understand what condition (e.g.
incorrect timestamps or whatever) is currently causing this behavior.

I am using Maven 3.9.1 on Windows 10. I also use Eclipse EE 2023-03,
which contains m2e (Eclipse's support for Maven). I start with [this
`pom.xml`](
https://github.com/globalmentor/globalmentor-root/blob/bce5bdbac7797b5b9114a72e5da2f4d76f3e24a7/pom.xml),

which uses `org.codehaus.mojo:versions-maven-plugin:2.12.0`, which in
turn (I am told) uses Maven Artifact Resolver. (Note that I've tried the
latest `org.codehaus.mojo:versions-maven-plugin:2.15.0` as well, with
the same results. I'm using this POM because it's available online and
does not contain any version ignores to cause confusion.)

I wanted to see what plugins were out of date, so I ran:

```bash
mvn versions:display-plugin-updates
```

It shows this:

```
[INFO] The following plugin updates are available:
[INFO]   maven-failsafe-plugin .......................... 2.22.2 ->
3.0.0-M7
[INFO]   maven-release-plugin ............................ 2.5.3 ->
3.0.0-M6
[INFO]   maven-site-plugin .............................. 3.12.1 ->
4.0.0-M3
[INFO]   maven-surefire-plugin .......................... 2.22.2 ->
3.0.0-M7
[INFO]   org.springframework.boot:spring-boot-maven-plugin .. 2.7.3 ->
3.0.5
```

However in Versions Maven Plugin Issue #959 (see link above), Andrzej
Jarmoniuk ran the same command and came up with different answers. Here
are two examples:

```
[INFO]   org.springframework.boot:spring-boot-maven-plugin .. 2.7.3 ->
3.1.0
```

Note that my output is only showing v3.0.5 is available for
`org.springframework.boot:spring-boot-maven-plugin`. Furthermore there
are later versions available for some of the other plugins as well.

```
[INFO] com.akathist.maven.plugins.launch4j:launch4j-maven-plugin  2.1.3
-> 2.4.1
```

My output doesn't even show
`com.akathist.maven.plugins.launch4j:launch4j-maven-plugin`; apparently
it thinks thje v2.1.3 listed in the POM is the latest available!

It would appear that Maven Artifact Resolver is somehow "stuck" at some
earlier point in time on my machine.

I ran Maven with the `-X` option, and here is part of the output related
to `com.akathist.maven.plugins.launch4j:launch4j-maven-plugin`:

```
…
[DEBUG] Checking
com.akathist.maven.plugins.launch4j:launch4j-maven-plugin for updates
newer than 2.1.3
[DEBUG] Could not find metadata
com.akathist.maven.plugins.launch4j:launch4j-maven-plugin/maven-metadata.xml

in local (C:\Users\user\.m2\repository)
[DEBUG] Skipped remote request for
com.akathist.maven.plugins.launch4j:launch4j-maven-plugin/maven-metadata.xml,

locally cached metadata up-to-date
[DEBUG]
[com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].version=2.1.3
[DEBUG]

[com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].artifactVersion=2.1.2
[DEBUG]

[com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].effectiveVersion=2.1.3
[DEBUG]
[com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].specified=true
…
```

This debug information seems to be saying that it can't find
`C:\Users\user\.m2\repository\com\akathist\maven\plugins\launch4j\launch4j-maven-plugin\maven-metadata.xml`.

And in fact that file does not exist! Instead I have
`C:\Users\user\.m2\repository\com\akathist\maven\plugins\launch4j\launch4j-maven-plugin\maven-metadata-central.xml`.

(I don't know what the differences are.)

The more ominous line is this one:

  > `[DEBUG] Skipped remote request for
com.akathist.maven.plugins.launch4j:launch4j-maven-plugin/maven-metadata.xml,

locally cached metadata up-to-date`

What might be causing Maven Resolver on my machine to get "stuck" at an
earlier point in time, and/or to skip checking Maven Central altogether
for newer versions of many plugins?

Garret Wilson


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to