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

make maven settings plugin work with recent versions of gradle & maven #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
52 changes: 24 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,55 +1,51 @@
plugins {
id 'com.gradle.build-scan' version '1.16'
id 'groovy'
id 'maven'
id "com.gradle.plugin-publish" version "0.9.10"
}

buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
id 'maven-publish'
id "com.gradle.plugin-publish" version "1.0.0"
}

ext {
mavenVersion = '3.0.5'
mavenVersion = '3.8.6'
}

repositories {
mavenCentral()
}

dependencies {
compile gradleApi()
compile localGroovy()
compile "org.apache.maven:maven-settings:$mavenVersion"
compile "org.apache.maven:maven-settings-builder:$mavenVersion"
compile "org.apache.maven:maven-model-builder:$mavenVersion"
compile "org.apache.maven:maven-model:$mavenVersion"
compile "org.apache.maven:maven-core:$mavenVersion"
compile 'org.sonatype.plexus:plexus-cipher:1.4'
compile 'org.sonatype.plexus:plexus-sec-dispatcher:1.3'
testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-library:1.3'
implementation gradleApi()
implementation localGroovy()
implementation "org.apache.maven:maven-settings:$mavenVersion"
implementation "org.apache.maven:maven-settings-builder:$mavenVersion"
implementation "org.apache.maven:maven-model-builder:$mavenVersion"
implementation "org.apache.maven:maven-model:$mavenVersion"
implementation "org.apache.maven:maven-core:$mavenVersion"
implementation 'org.sonatype.plexus:plexus-cipher:1.4'
implementation 'org.sonatype.plexus:plexus-sec-dispatcher:1.3'
testImplementation 'junit:junit:4.11'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
}

sourceCompatibility = '1.6'
targetCompatibility = '1.6'
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

pluginBundle {
website = 'https://github.com/mark-vieira/gradle-maven-settings-plugin'
vcsUrl = 'https://github.com/mark-vieira/gradle-maven-settings-plugin'
description = 'Gradle plugin for exposing Maven settings file configuration to Gradle project.'
tags = ['settings', 'maven']

}

gradlePlugin {

plugins {
mavenSettings {
id = 'net.linguica.maven-settings'
displayName = 'Maven Settings Plugin'
implementationClass = 'net.linguica.gradle.maven.settings.MavenSettingsPlugin'
}
}

mavenCoordinates {
groupId = 'net.linguica.gradle'
artifactId = 'maven-settings-plugin'
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'maven-settings-plugin'
rootProject.name = 'maven-settings-plugin'
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.apache.maven.model.InputLocation
import org.apache.maven.model.Profile
import org.apache.maven.model.building.ModelProblem
import org.apache.maven.model.building.ModelProblemCollector
import org.apache.maven.model.building.ModelProblemCollectorRequest
import org.apache.maven.model.path.DefaultPathTranslator
import org.apache.maven.model.profile.DefaultProfileActivationContext
import org.apache.maven.model.profile.DefaultProfileSelector
Expand Down Expand Up @@ -78,8 +79,10 @@ class MavenSettingsPlugin implements Plugin<Project> {
private void activateProfiles(Project project, MavenSettingsPluginExtension extension) {
DefaultProfileSelector profileSelector = new DefaultProfileSelector()
DefaultProfileActivationContext activationContext = new DefaultProfileActivationContext()
List<ProfileActivator> profileActivators = [new JdkVersionProfileActivator(), new OperatingSystemProfileActivator(),
new PropertyProfileActivator(), new FileProfileActivator().setPathTranslator(new DefaultPathTranslator())]
List<ProfileActivator> profileActivators = [new JdkVersionProfileActivator(),
new OperatingSystemProfileActivator(),
new PropertyProfileActivator(),
new FileProfileActivator()]
profileActivators.each { profileSelector.addProfileActivator(it) }

activationContext.setActiveProfileIds(extension.activeProfiles.toList() + settings.activeProfiles)
Expand All @@ -92,13 +95,13 @@ class MavenSettingsPlugin implements Plugin<Project> {
List<Profile> profiles = profileSelector.getActiveProfiles(settings.profiles.collect { return SettingsUtils.convertFromSettingsProfile(it) },
activationContext, new ModelProblemCollector() {
@Override
void add(ModelProblem.Severity severity, String s, InputLocation inputLocation, Exception e) {
void add(ModelProblemCollectorRequest req) {

}
})

profiles.each { profile ->
for (Entry entry: profile.properties) {
for (Entry entry : profile.properties) {
project.extensions.getByType(ExtraPropertiesExtension).set(entry.key.toString(), entry.value.toString())
}
}
Expand Down

This file was deleted.