Skip to content

[MNG-7706] Deprecate 'localRepository' parameter expression (#1009)#1012

Merged
cstamas merged 1 commit intoapache:masterfrom
cstamas:MNG-7706-deprecate-localRepository-expr
Feb 23, 2023
Merged

[MNG-7706] Deprecate 'localRepository' parameter expression (#1009)#1012
cstamas merged 1 commit intoapache:masterfrom
cstamas:MNG-7706-deprecate-localRepository-expr

Conversation

@cstamas
Copy link
Member

@cstamas cstamas commented Feb 23, 2023

This PR deprecates the 'localRepository' mojo parameter expression, and Core will emit warning if used by any Mojo.

Forward port of #1009


https://issues.apache.org/jira/browse/MNG-7706

)

This PR deprecates the 'localRepository' mojo parameter expression, and Core will emit warning if used by any Mojo.

---

https://issues.apache.org/jira/browse/MNG-7706
@cstamas cstamas self-assigned this Feb 23, 2023
@cstamas cstamas merged commit 22d2b47 into apache:master Feb 23, 2023
@cstamas cstamas deleted the MNG-7706-deprecate-localRepository-expr branch February 23, 2023 17:14
@paulwwisl
Copy link

paulwwisl commented Apr 14, 2023

Does this have to do with warning for test phase, when actually there are no tests at all?

mvn version 3.9.1

[INFO] --- surefire:2.22.2:test (default-test) @ ..... ---
[WARNING] Parameter 'localRepository' is deprecated core expression; Avoid use of ArtifactRepository type. If you need access to local repository, switch to '${repositorySystemSession}' expression and get LRM from it instead.
[INFO] No tests to run.

@paulwwisl
Copy link

solved with latest 3.0.0 https://maven.apache.org/surefire/maven-surefire-plugin/

e.g. with Spring Boot

<maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>

@basil
Copy link

basil commented Apr 27, 2023

How should https://github.com/cloudbees/maven-license-plugin/blob/b58872cc1f4062ec01ca903d9a5546cc3b85a748/src/main/java/com/cloudbees/maven/license/ProcessMojo.java#L179 be adapted? The deprecation notice says to switch to repositorySystemSession.getLocalRepository(), but that does not compile:

java: incompatible types: org.eclipse.aether.repository.LocalRepository cannot be converted to org.apache.maven.artifact.repository.ArtifactRepository

@cstamas
Copy link
Member Author

cstamas commented Apr 27, 2023

  1. drop localRepository, remove buildingRequest.setLocalRepository(localRepository);
  2. instead grab RepositorySystemSession "${repositorySystemSession}"
  3. on ProjectBuildingRequest setSession from 2 and remove dropped setter from 1
  4. test it

@basil
Copy link

basil commented Apr 27, 2023

on ProjectBuildingRequest setSession from 2

The setSession method does not exist, but a setRepositorySession exists. But why should I call that when session.getProjectBuildingRequest() already calls it a few lines above?

@cstamas
Copy link
Member Author

cstamas commented Apr 27, 2023

Yup, setRepositorySession... if you are sure it is there, then not needed.

@cstamas
Copy link
Member Author

cstamas commented Apr 27, 2023

Just for future: please use ML for asks like this one :)
https://maven.apache.org/mailing-lists.html

@basil
Copy link

basil commented Apr 27, 2023

This migration was poorly documented. What you asked me to do had nothing to do with the instructions in the deprecation warning. I think it was appropriate to complain about that in this PR.

@jira-importer
Copy link

Resolve #9271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants