Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Ork committed Jan 8, 2024
1 parent 98dbefe commit f176848
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 1 deletion.
2 changes: 1 addition & 1 deletion org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.m2e.core.ui;singleton:=true
Bundle-Version: 2.0.7.qualifier
Bundle-Version: 2.0.8.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,10 @@ public class Messages extends NLS {

public static String MavenSettingsPreferencePage_error_userSettingsParse;

public static String MavenSettingsPreferencePage_error_userToolchainsMissing;

public static String MavenSettingsPreferencePage_error_userToolchainsParse;

public static String MavenSettingsPreferencePage_job_indexing;

public static String MavenSettingsPreferencePage_job_updating;
Expand Down Expand Up @@ -603,6 +607,14 @@ public class Messages extends NLS {

public static String MavenWarningsPreferencePage_notCoveredMojoExecution;

public static String MavenSettingsPreferencePage_userToolchainslink1;

public static String MavenSettingsPreferencePage_userToolchainslink2;

public static String MavenSettingsPreferencePage_userToolchainslink_tooltip;

public static String MavenSettingsPreferencePage_userToolchainsBrowseButton_text;

public static String MavenWarningsPreferencePage_versionDupParent;

public static String MavenWarningsPreferencePage_overridingManagedPreferences;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,19 @@ MavenSettingsPreferencePage_error_globalSettingsMissing=Global settings file doe
MavenSettingsPreferencePage_error_userSettingsMissing=User settings file doesn't exist
MavenSettingsPreferencePage_error_globalSettingsParse=Unable to parse global settings file {0}
MavenSettingsPreferencePage_error_userSettingsParse=Unable to parse user settings file {0}
MavenSettingsPreferencePage_error_userToolchainsMissing=User toolchains file doesn't exist
MavenSettingsPreferencePage_error_userToolchainsParse=Unable to parse user toolchains file {0}
MavenSettingsPreferencePage_globalSettingsBrowseButton_text=Browse...
MavenSettingsPreferencePage_job_indexing=Indexing Local Repository...
MavenSettingsPreferencePage_job_updating=Updating Maven settings
MavenSettingsPreferencePage_lblLocal=Local Repository (From merged user and global settings)\:
MavenSettingsPreferencePage_userSettingslink1=User &Settings\:
MavenSettingsPreferencePage_userSettingslink2=User &Settings (<a href\="\#">open file</a>)\:
MavenSettingsPreferencePage_userSettingslink_tooltip=Open editor for user settings
MavenSettingsPreferencePage_userToolchainslink1=User &Toolchains\:
MavenSettingsPreferencePage_userToolchainslink2=User &Toolchains (<a href\="\#">open file</a>)\:
MavenSettingsPreferencePage_userToolchainslink_tooltip=Open editor for user toolchains
MavenSettingsPreferencePage_userToolchainsBrowseButton_text=Browse...
MavenSettingsPreferencePage_globalSettingslink1=Global &Settings\:
MavenSettingsPreferencePage_globalSettingslink2=Global &Settings (<a href\="\#">open file</a>)\:
MavenSettingsPreferencePage_globalSettingslink_tooltip=Open editor for global settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.building.Problem;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.MavenExecutionPlan;
Expand Down Expand Up @@ -215,6 +216,14 @@ <T> T getMojoParameterValue(MavenProject project, String parameter, Class<T> typ

List<SettingsProblem> validateSettings(String settings);

/**
* Validates the toolchains definition
*
* @param toolchains The path to the toolchains definition file to test.
* @return List of all problems. Is never <code>null</code>.
*/
List<Problem> validateToolchains(String toolchains);

List<Mirror> getMirrors() throws CoreException;

Mirror getMirror(ArtifactRepository repo) throws CoreException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public interface IMavenConfiguration {

void setUserSettingsFile(String absolutePath) throws CoreException;

String getUserToolchainsFile();

void setUserToolchainsFile(String absolutePath) throws CoreException;

// resolution

boolean isDownloadSources();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ public class Messages extends NLS {

public static String MavenImpl_error_read_settings2;

public static String MavenImpl_error_read_toolchains2;

public static String MavenImpl_error_resolve;

public static String MavenImpl_error_sort;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.cli.MavenCli;
import org.apache.maven.cli.configuration.SettingsXmlConfigurationProcessor;
import org.apache.maven.eventspy.internal.EventSpyDispatcher;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
Expand Down Expand Up @@ -176,6 +177,13 @@ static MavenExecutionRequest createExecutionRequest(IMavenConfiguration mavenCon
request.setUserSettingsFile(userSettingsFile);

//and settings are actually derived from IMavenConfiguration

File userToolchainsFile = MavenCli.DEFAULT_USER_TOOLCHAINS_FILE;
if(mavenConfiguration.getUserToolchainsFile() != null) {
userToolchainsFile = new File(mavenConfiguration.getUserToolchainsFile());
}
request.setUserToolchainsFile(userToolchainsFile);

try {
request = lookup.lookup(MavenExecutionRequestPopulator.class).populateFromSettings(request, settings);
} catch(MavenExecutionRequestPopulationException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.building.FileSource;
import org.apache.maven.building.Problem;
import org.apache.maven.building.ProblemCollector;
import org.apache.maven.building.ProblemCollectorFactory;
import org.apache.maven.cli.configuration.SettingsXmlConfigurationProcessor;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.DefaultMavenExecutionResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ MavenImpl_error_read_pom=Could not read pom.xml
MavenImpl_error_read_project=Could not read maven project
MavenImpl_error_read_settings=Could not read settings.xml
MavenImpl_error_read_settings2=Can not read settings file {0}
MavenImpl_error_read_toolchains2=Can not read toolchains file {0}
MavenImpl_error_resolve=Could not resolve artifact {0}
MavenImpl_error_sort=unable to sort projects
MavenImpl_error_write_lastUpdated=Could not write artifact lastUpdated status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ public String getUserSettingsFile() {
return preferenceStore.get(MavenPreferenceConstants.P_USER_SETTINGS_FILE, null, preferencesLookup);
}

@Override
public String getUserToolchainsFile() {
return preferenceStore.get(MavenPreferenceConstants.P_USER_TOOLCHAINS_FILE, null, preferencesLookup);
}

@Override
public boolean isDebugOutput() {
return Boolean.parseBoolean(preferenceStore.get(MavenPreferenceConstants.P_DEBUG_OUTPUT, null, preferencesLookup));
Expand Down Expand Up @@ -167,6 +172,19 @@ public void setGlobalSettingsFile(String globalSettingsFile) throws CoreExceptio
}
}

@Override
public void setUserToolchainsFile(String settingsFile) throws CoreException {
settingsFile = trim(settingsFile);
if(!eq(settingsFile, preferencesLookup[0].get(MavenPreferenceConstants.P_USER_TOOLCHAINS_FILE, null))) {
if(settingsFile != null) {
preferencesLookup[0].put(MavenPreferenceConstants.P_USER_TOOLCHAINS_FILE, settingsFile);
} else {
preferencesLookup[0].remove(MavenPreferenceConstants.P_USER_TOOLCHAINS_FILE);
}
preferenceStore.applyPreferences(preferencesLookup[0], new IPreferenceFilter[] {getPreferenceFilter()});
}
}

private boolean eq(String a, String b) {
return a != null ? a.equals(b) : b == null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public interface MavenPreferenceConstants {
/** String */
String P_USER_SETTINGS_FILE = PREFIX + "userSettingsFile"; //$NON-NLS-1$

/** String */
String P_USER_TOOLCHAINS_FILE = PREFIX + "userToolchainsFile"; //$NON-NLS-1$

/** String */
String P_OUTPUT_FOLDER = PREFIX + "outputFolder"; //$NON-NLS-1$

Expand Down

0 comments on commit f176848

Please sign in to comment.