Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

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.

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.

4 participants