You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Delany <de...@gmail.com> on 2024/03/25 08:21:00 UTC

Relax resolver for snapshots in offline mode

Hi,

I have a bunch of plugins like enforcer that I want to run with `mvn
validate -o` but I get
Cannot access *repo* in offline mode and the artifact
*artifact*:jar:2.4.1-20240322.141808-12 has not been downloaded from it
before

There are snapshots of that artifact available in local maven repo, just
not that specific one.
I thought changing the updatePolicy to NEVER would solve this, but the new
enforcer (which now uses resolver) fails nonetheless.

Is there a way to get resolver to treat all snapshots as equal in offline
mode? Is there a reason this isn't the default?

Thanks,
Delany

Re: Relax resolver for snapshots in offline mode

Posted by Tamás Cservenák <ta...@cservenak.net>.
Delany,

tried to recreate:
https://github.com/cstamas/delany-ml-repro

And I may miss something, but it works for me?

T

On Wed, Mar 27, 2024 at 1:31 PM Tamás Cservenák <ta...@cservenak.net> wrote:

> Delany,
>
> What goal do you invoke to get this? "mvn validate"?
> Do you have any plugin bound to this phase?
>
> T
>
> On Tue, Mar 26, 2024 at 3:54 PM Delany <de...@gmail.com> wrote:
>
>> If a pom says it has a dependency "<version>2.4.1-SNAPSHOT</version>" then
>> I don't want the validation failing in offline mode because
>> "2.4.1-20240322.141808-12 has not been downloaded".
>> Delany
>>
>>
>> On Tue, 26 Mar 2024 at 16:15, Tamás Cservenák <ta...@cservenak.net>
>> wrote:
>>
>> > Delany,
>> >
>> > What do you mean by "All SNAPSHOT versions are equal"?
>> >
>> > T
>> >
>> > On Tue, Mar 26, 2024 at 10:33 AM Delany <de...@gmail.com>
>> > wrote:
>> >
>> > > Ok, I want to validate various aspects of the project without going
>> > network
>> > > since there are a lot of modules, some of them quite big, and they get
>> > > rebuilt every day, so its hundreds of Mb that get updated.
>> > > I want to check the well-formedness of the pom.xml files, sort them,
>> also
>> > > run a yak4j-filename-conventions-maven-plugin, etc.
>> > > All things to do with the integrity of the files and the configuration
>> > > model that's unrelated to classes and dependencies.
>> > > Probably a lot of these should actually be handled with git hooks, but
>> > for
>> > > various reasons that's not currently an option.
>> > > I'm looking for a button to push that will say "All SNAPSHOT versions
>> are
>> > > equal". And you can add to that "from any repository".
>> > > I get why you wouldn't want to introduce that though. Thanks for
>> > answering.
>> > > Delany
>> > >
>> > >
>> > > On Tue, 26 Mar 2024 at 10:49, Tamás Cservenák <ta...@cservenak.net>
>> > wrote:
>> > >
>> > > > Howdy,
>> > > >
>> > > > you are conflating several things here:
>> > > > - timestamped snapshots are coming from remote (as locally installed
>> > ones
>> > > > are NOT timestamped), these snapshots can be resolved ONLY via
>> metadata
>> > > > - artifact origin tracking: if artifact A was downloaded from
>> > repository
>> > > > R1, a subsequent build run on same local repo that does not have R1
>> > > defined
>> > > > (obviously, R1 cannot be central) will NOT have A reported as
>> > "available"
>> > > > only as it is present on disk (Maven2 did this, Maven3 fixed did
>> this).
>> > > > - update policy is unrelated to both above
>> > > >
>> > > > Hence, to me your question does not make sense.
>> > > > Let me reverse: what is your goal you want to achieve?
>> > > >
>> > > > T
>> > > >
>> > > > On Mon, Mar 25, 2024 at 9:21 AM Delany <de...@gmail.com>
>> > > wrote:
>> > > >
>> > > > > Hi,
>> > > > >
>> > > > > I have a bunch of plugins like enforcer that I want to run with
>> `mvn
>> > > > > validate -o` but I get
>> > > > > Cannot access *repo* in offline mode and the artifact
>> > > > > *artifact*:jar:2.4.1-20240322.141808-12 has not been downloaded
>> from
>> > it
>> > > > > before
>> > > > >
>> > > > > There are snapshots of that artifact available in local maven
>> repo,
>> > > just
>> > > > > not that specific one.
>> > > > > I thought changing the updatePolicy to NEVER would solve this, but
>> > the
>> > > > new
>> > > > > enforcer (which now uses resolver) fails nonetheless.
>> > > > >
>> > > > > Is there a way to get resolver to treat all snapshots as equal in
>> > > offline
>> > > > > mode? Is there a reason this isn't the default?
>> > > > >
>> > > > > Thanks,
>> > > > > Delany
>> > > > >
>> > > >
>> > >
>> >
>>
>

Re: Relax resolver for snapshots in offline mode

Posted by Tamás Cservenák <ta...@cservenak.net>.
Delany,

What goal do you invoke to get this? "mvn validate"?
Do you have any plugin bound to this phase?

T

On Tue, Mar 26, 2024 at 3:54 PM Delany <de...@gmail.com> wrote:

> If a pom says it has a dependency "<version>2.4.1-SNAPSHOT</version>" then
> I don't want the validation failing in offline mode because
> "2.4.1-20240322.141808-12 has not been downloaded".
> Delany
>
>
> On Tue, 26 Mar 2024 at 16:15, Tamás Cservenák <ta...@cservenak.net> wrote:
>
> > Delany,
> >
> > What do you mean by "All SNAPSHOT versions are equal"?
> >
> > T
> >
> > On Tue, Mar 26, 2024 at 10:33 AM Delany <de...@gmail.com>
> > wrote:
> >
> > > Ok, I want to validate various aspects of the project without going
> > network
> > > since there are a lot of modules, some of them quite big, and they get
> > > rebuilt every day, so its hundreds of Mb that get updated.
> > > I want to check the well-formedness of the pom.xml files, sort them,
> also
> > > run a yak4j-filename-conventions-maven-plugin, etc.
> > > All things to do with the integrity of the files and the configuration
> > > model that's unrelated to classes and dependencies.
> > > Probably a lot of these should actually be handled with git hooks, but
> > for
> > > various reasons that's not currently an option.
> > > I'm looking for a button to push that will say "All SNAPSHOT versions
> are
> > > equal". And you can add to that "from any repository".
> > > I get why you wouldn't want to introduce that though. Thanks for
> > answering.
> > > Delany
> > >
> > >
> > > On Tue, 26 Mar 2024 at 10:49, Tamás Cservenák <ta...@cservenak.net>
> > wrote:
> > >
> > > > Howdy,
> > > >
> > > > you are conflating several things here:
> > > > - timestamped snapshots are coming from remote (as locally installed
> > ones
> > > > are NOT timestamped), these snapshots can be resolved ONLY via
> metadata
> > > > - artifact origin tracking: if artifact A was downloaded from
> > repository
> > > > R1, a subsequent build run on same local repo that does not have R1
> > > defined
> > > > (obviously, R1 cannot be central) will NOT have A reported as
> > "available"
> > > > only as it is present on disk (Maven2 did this, Maven3 fixed did
> this).
> > > > - update policy is unrelated to both above
> > > >
> > > > Hence, to me your question does not make sense.
> > > > Let me reverse: what is your goal you want to achieve?
> > > >
> > > > T
> > > >
> > > > On Mon, Mar 25, 2024 at 9:21 AM Delany <de...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I have a bunch of plugins like enforcer that I want to run with
> `mvn
> > > > > validate -o` but I get
> > > > > Cannot access *repo* in offline mode and the artifact
> > > > > *artifact*:jar:2.4.1-20240322.141808-12 has not been downloaded
> from
> > it
> > > > > before
> > > > >
> > > > > There are snapshots of that artifact available in local maven repo,
> > > just
> > > > > not that specific one.
> > > > > I thought changing the updatePolicy to NEVER would solve this, but
> > the
> > > > new
> > > > > enforcer (which now uses resolver) fails nonetheless.
> > > > >
> > > > > Is there a way to get resolver to treat all snapshots as equal in
> > > offline
> > > > > mode? Is there a reason this isn't the default?
> > > > >
> > > > > Thanks,
> > > > > Delany
> > > > >
> > > >
> > >
> >
>

Re: Relax resolver for snapshots in offline mode

Posted by Delany <de...@gmail.com>.
If a pom says it has a dependency "<version>2.4.1-SNAPSHOT</version>" then
I don't want the validation failing in offline mode because
"2.4.1-20240322.141808-12 has not been downloaded".
Delany


On Tue, 26 Mar 2024 at 16:15, Tamás Cservenák <ta...@cservenak.net> wrote:

> Delany,
>
> What do you mean by "All SNAPSHOT versions are equal"?
>
> T
>
> On Tue, Mar 26, 2024 at 10:33 AM Delany <de...@gmail.com>
> wrote:
>
> > Ok, I want to validate various aspects of the project without going
> network
> > since there are a lot of modules, some of them quite big, and they get
> > rebuilt every day, so its hundreds of Mb that get updated.
> > I want to check the well-formedness of the pom.xml files, sort them, also
> > run a yak4j-filename-conventions-maven-plugin, etc.
> > All things to do with the integrity of the files and the configuration
> > model that's unrelated to classes and dependencies.
> > Probably a lot of these should actually be handled with git hooks, but
> for
> > various reasons that's not currently an option.
> > I'm looking for a button to push that will say "All SNAPSHOT versions are
> > equal". And you can add to that "from any repository".
> > I get why you wouldn't want to introduce that though. Thanks for
> answering.
> > Delany
> >
> >
> > On Tue, 26 Mar 2024 at 10:49, Tamás Cservenák <ta...@cservenak.net>
> wrote:
> >
> > > Howdy,
> > >
> > > you are conflating several things here:
> > > - timestamped snapshots are coming from remote (as locally installed
> ones
> > > are NOT timestamped), these snapshots can be resolved ONLY via metadata
> > > - artifact origin tracking: if artifact A was downloaded from
> repository
> > > R1, a subsequent build run on same local repo that does not have R1
> > defined
> > > (obviously, R1 cannot be central) will NOT have A reported as
> "available"
> > > only as it is present on disk (Maven2 did this, Maven3 fixed did this).
> > > - update policy is unrelated to both above
> > >
> > > Hence, to me your question does not make sense.
> > > Let me reverse: what is your goal you want to achieve?
> > >
> > > T
> > >
> > > On Mon, Mar 25, 2024 at 9:21 AM Delany <de...@gmail.com>
> > wrote:
> > >
> > > > Hi,
> > > >
> > > > I have a bunch of plugins like enforcer that I want to run with `mvn
> > > > validate -o` but I get
> > > > Cannot access *repo* in offline mode and the artifact
> > > > *artifact*:jar:2.4.1-20240322.141808-12 has not been downloaded from
> it
> > > > before
> > > >
> > > > There are snapshots of that artifact available in local maven repo,
> > just
> > > > not that specific one.
> > > > I thought changing the updatePolicy to NEVER would solve this, but
> the
> > > new
> > > > enforcer (which now uses resolver) fails nonetheless.
> > > >
> > > > Is there a way to get resolver to treat all snapshots as equal in
> > offline
> > > > mode? Is there a reason this isn't the default?
> > > >
> > > > Thanks,
> > > > Delany
> > > >
> > >
> >
>

Re: Relax resolver for snapshots in offline mode

Posted by Tamás Cservenák <ta...@cservenak.net>.
Delany,

What do you mean by "All SNAPSHOT versions are equal"?

T

On Tue, Mar 26, 2024 at 10:33 AM Delany <de...@gmail.com> wrote:

> Ok, I want to validate various aspects of the project without going network
> since there are a lot of modules, some of them quite big, and they get
> rebuilt every day, so its hundreds of Mb that get updated.
> I want to check the well-formedness of the pom.xml files, sort them, also
> run a yak4j-filename-conventions-maven-plugin, etc.
> All things to do with the integrity of the files and the configuration
> model that's unrelated to classes and dependencies.
> Probably a lot of these should actually be handled with git hooks, but for
> various reasons that's not currently an option.
> I'm looking for a button to push that will say "All SNAPSHOT versions are
> equal". And you can add to that "from any repository".
> I get why you wouldn't want to introduce that though. Thanks for answering.
> Delany
>
>
> On Tue, 26 Mar 2024 at 10:49, Tamás Cservenák <ta...@cservenak.net> wrote:
>
> > Howdy,
> >
> > you are conflating several things here:
> > - timestamped snapshots are coming from remote (as locally installed ones
> > are NOT timestamped), these snapshots can be resolved ONLY via metadata
> > - artifact origin tracking: if artifact A was downloaded from repository
> > R1, a subsequent build run on same local repo that does not have R1
> defined
> > (obviously, R1 cannot be central) will NOT have A reported as "available"
> > only as it is present on disk (Maven2 did this, Maven3 fixed did this).
> > - update policy is unrelated to both above
> >
> > Hence, to me your question does not make sense.
> > Let me reverse: what is your goal you want to achieve?
> >
> > T
> >
> > On Mon, Mar 25, 2024 at 9:21 AM Delany <de...@gmail.com>
> wrote:
> >
> > > Hi,
> > >
> > > I have a bunch of plugins like enforcer that I want to run with `mvn
> > > validate -o` but I get
> > > Cannot access *repo* in offline mode and the artifact
> > > *artifact*:jar:2.4.1-20240322.141808-12 has not been downloaded from it
> > > before
> > >
> > > There are snapshots of that artifact available in local maven repo,
> just
> > > not that specific one.
> > > I thought changing the updatePolicy to NEVER would solve this, but the
> > new
> > > enforcer (which now uses resolver) fails nonetheless.
> > >
> > > Is there a way to get resolver to treat all snapshots as equal in
> offline
> > > mode? Is there a reason this isn't the default?
> > >
> > > Thanks,
> > > Delany
> > >
> >
>

Re: Relax resolver for snapshots in offline mode

Posted by Delany <de...@gmail.com>.
Ok, I want to validate various aspects of the project without going network
since there are a lot of modules, some of them quite big, and they get
rebuilt every day, so its hundreds of Mb that get updated.
I want to check the well-formedness of the pom.xml files, sort them, also
run a yak4j-filename-conventions-maven-plugin, etc.
All things to do with the integrity of the files and the configuration
model that's unrelated to classes and dependencies.
Probably a lot of these should actually be handled with git hooks, but for
various reasons that's not currently an option.
I'm looking for a button to push that will say "All SNAPSHOT versions are
equal". And you can add to that "from any repository".
I get why you wouldn't want to introduce that though. Thanks for answering.
Delany


On Tue, 26 Mar 2024 at 10:49, Tamás Cservenák <ta...@cservenak.net> wrote:

> Howdy,
>
> you are conflating several things here:
> - timestamped snapshots are coming from remote (as locally installed ones
> are NOT timestamped), these snapshots can be resolved ONLY via metadata
> - artifact origin tracking: if artifact A was downloaded from repository
> R1, a subsequent build run on same local repo that does not have R1 defined
> (obviously, R1 cannot be central) will NOT have A reported as "available"
> only as it is present on disk (Maven2 did this, Maven3 fixed did this).
> - update policy is unrelated to both above
>
> Hence, to me your question does not make sense.
> Let me reverse: what is your goal you want to achieve?
>
> T
>
> On Mon, Mar 25, 2024 at 9:21 AM Delany <de...@gmail.com> wrote:
>
> > Hi,
> >
> > I have a bunch of plugins like enforcer that I want to run with `mvn
> > validate -o` but I get
> > Cannot access *repo* in offline mode and the artifact
> > *artifact*:jar:2.4.1-20240322.141808-12 has not been downloaded from it
> > before
> >
> > There are snapshots of that artifact available in local maven repo, just
> > not that specific one.
> > I thought changing the updatePolicy to NEVER would solve this, but the
> new
> > enforcer (which now uses resolver) fails nonetheless.
> >
> > Is there a way to get resolver to treat all snapshots as equal in offline
> > mode? Is there a reason this isn't the default?
> >
> > Thanks,
> > Delany
> >
>

Re: Relax resolver for snapshots in offline mode

Posted by Tamás Cservenák <ta...@cservenak.net>.
Howdy,

you are conflating several things here:
- timestamped snapshots are coming from remote (as locally installed ones
are NOT timestamped), these snapshots can be resolved ONLY via metadata
- artifact origin tracking: if artifact A was downloaded from repository
R1, a subsequent build run on same local repo that does not have R1 defined
(obviously, R1 cannot be central) will NOT have A reported as "available"
only as it is present on disk (Maven2 did this, Maven3 fixed did this).
- update policy is unrelated to both above

Hence, to me your question does not make sense.
Let me reverse: what is your goal you want to achieve?

T

On Mon, Mar 25, 2024 at 9:21 AM Delany <de...@gmail.com> wrote:

> Hi,
>
> I have a bunch of plugins like enforcer that I want to run with `mvn
> validate -o` but I get
> Cannot access *repo* in offline mode and the artifact
> *artifact*:jar:2.4.1-20240322.141808-12 has not been downloaded from it
> before
>
> There are snapshots of that artifact available in local maven repo, just
> not that specific one.
> I thought changing the updatePolicy to NEVER would solve this, but the new
> enforcer (which now uses resolver) fails nonetheless.
>
> Is there a way to get resolver to treat all snapshots as equal in offline
> mode? Is there a reason this isn't the default?
>
> Thanks,
> Delany
>