logic: allow to specify custom Maven settings.xml file in project settings (issue #794) (#847)

This commit is contained in:
Malte Langkabel
2019-12-11 14:00:20 +01:00
committed by GitHub
parent d33a5357dd
commit 3932bb1fb8
10 changed files with 159 additions and 11 deletions
@@ -35,13 +35,30 @@ void SourceGroupSettingsWithJavaMaven::setShouldIndexMavenTests(bool value)
m_shouldIndexMavenTests = value;
}
FilePath SourceGroupSettingsWithJavaMaven::getMavenSettingsFilePath() const
{
return m_mavenSettingsFilePath;
}
FilePath SourceGroupSettingsWithJavaMaven::getMavenSettingsFilePathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(
getMavenSettingsFilePath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsWithJavaMaven::setMavenSettingsFilePath(const FilePath& path)
{
m_mavenSettingsFilePath = path;
}
bool SourceGroupSettingsWithJavaMaven::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithJavaMaven* otherPtr =
dynamic_cast<const SourceGroupSettingsWithJavaMaven*>(other);
return (
otherPtr && m_mavenProjectFilePath == otherPtr->m_mavenProjectFilePath &&
otherPtr && m_mavenProjectFilePath == otherPtr->m_mavenProjectFilePath && otherPtr &&
m_mavenSettingsFilePath == otherPtr->m_mavenSettingsFilePath &&
m_shouldIndexMavenTests == otherPtr->m_shouldIndexMavenTests);
}
@@ -49,11 +66,14 @@ void SourceGroupSettingsWithJavaMaven::load(const ConfigManager* config, const s
{
setMavenProjectFilePath(
config->getValueOrDefault(key + "/maven/project_file_path", FilePath(L"")));
setMavenSettingsFilePath(
config->getValueOrDefault(key + "/maven/settings_file_path", FilePath(L"")));
setShouldIndexMavenTests(config->getValueOrDefault(key + "/maven/should_index_tests", false));
}
void SourceGroupSettingsWithJavaMaven::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/maven/project_file_path", getMavenProjectFilePath().wstr());
config->setValue(key + "/maven/settings_file_path", getMavenSettingsFilePath().wstr());
config->setValue(key + "/maven/should_index_tests", getShouldIndexMavenTests());
}
@@ -18,6 +18,10 @@ public:
bool getShouldIndexMavenTests() const;
void setShouldIndexMavenTests(bool value);
FilePath getMavenSettingsFilePath() const;
FilePath getMavenSettingsFilePathExpandedAndAbsolute() const;
void setMavenSettingsFilePath(const FilePath& path);
protected:
bool equals(const SourceGroupSettingsBase* other) const override;
@@ -27,6 +31,7 @@ protected:
private:
FilePath m_mavenProjectFilePath;
bool m_shouldIndexMavenTests = false;
FilePath m_mavenSettingsFilePath;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_JAVA_MAVEN_H