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

Correctly determine the version of the underlying javac tool #357

Merged
merged 4 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,20 @@ public void setOptimize(boolean optimize) {
this.optimize = optimize;
}

/**
* @deprecated Don't use any longer because this is just the configured version which does not necessarily match the version
* of the actually executed compiler binary
*/
@Deprecated
public String getCompilerVersion() {
return compilerVersion;
}

/**
* @deprecated Don't use any longer because this is just the configured version which does not necessarily match the version
* of the actually executed compiler binary
*/
@Deprecated
public void setCompilerVersion(String compilerVersion) {
this.compilerVersion = compilerVersion;
}
Expand Down
2 changes: 1 addition & 1 deletion plexus-compiler-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<artifactId>maven-settings-builder</artifactId>
<version>${mavenVersion}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.properties.internal.SystemProperties;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
import org.apache.maven.settings.building.DefaultSettingsBuilderFactory;
import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
import org.apache.maven.settings.building.SettingsBuildingRequest;
import org.codehaus.plexus.testing.PlexusTest;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.hamcrest.io.FileMatchers;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -83,7 +85,13 @@ final void setUpLocalRepo() throws Exception {
if (localRepo == null) {
File settingsFile = new File(System.getProperty("user.home"), ".m2/settings.xml");
if (settingsFile.exists()) {
Settings settings = new SettingsXpp3Reader().read(ReaderFactory.newXmlReader(settingsFile));
SettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
request.setUserSettingsFile(settingsFile);
request.setSystemProperties(SystemProperties.getSystemProperties());
Settings settings = new DefaultSettingsBuilderFactory()
.newInstance()
.build(request)
.getEffectiveSettings();
localRepo = settings.getLocalRepository();
}
}
Expand Down Expand Up @@ -116,7 +124,7 @@ protected List<String> getClasspath() throws Exception {
File file = getLocalArtifactPath("commons-lang", "commons-lang", "2.0", "jar");

assertThat(
"test prerequisite: commons-lang library must be available in local repository, expected ",
"test prerequisite: commons-lang library must be available in local repository at " + file,
file,
FileMatchers.aReadableFile());

Expand Down
Loading