mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-01 09:42:13 +00:00
- Gradle projects contain cycles which comes from dependencies to test sources which is not a problem in gradle but eclipse metadata generation is getting confused. Thus we need settings to relax errors org.eclipse.jdt.core.circularClasspath=warning org.eclipse.jdt.core.incompleteClasspath=warning - Additionally .classpath entries needs to be changes having without_test_code=false test=false - Aspects end up getting source dirs `build/classes/java/main` and `build/resources/main` which never have sources. Vscode complains about that, eclipse is fine. Remove those from entries. - In tests `htmlunit` depends on `xml-apis`. `xml-apis` are now part of jdk and eclipse complains about that. Excluse these in a gradle build. - Both eclipse and vscode don't currently work with buildship, due to project cycles and buildship cannot be configured. It's possible to create metadata from `eclipse` task manually which then can be imported. For this we need to disable automatic import in vscode using buildship. This goes to `.vscode/settings.json` workspace config. - Then with these changes user can do something like git clean -fxd && ./gradlew clean build cleanEclipse eclipse -x checkstyleNohttp -x test -x integrationTest and import projects manually.
74 lines
2.8 KiB
Groovy
74 lines
2.8 KiB
Groovy
/*
|
|
* Copyright 2002-2016 the original author or authors.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
* use this file except in compliance with the License. You may obtain a copy of
|
|
* the License at
|
|
*
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
* License for the specific language governing permissions and limitations under
|
|
* the License.
|
|
*/
|
|
|
|
package io.spring.gradle.convention;
|
|
|
|
import org.gradle.api.Plugin;
|
|
import org.gradle.api.Project;
|
|
import org.gradle.api.plugins.GroovyPlugin;
|
|
import org.gradle.api.plugins.JavaPlugin
|
|
import org.gradle.api.plugins.PluginManager;
|
|
import org.gradle.plugins.ide.eclipse.EclipseWtpPlugin;
|
|
import org.gradle.plugins.ide.idea.IdeaPlugin;
|
|
import org.springframework.gradle.CopyPropertiesPlugin
|
|
import org.springframework.gradle.propdeps.PropDepsEclipsePlugin
|
|
import org.springframework.gradle.propdeps.PropDepsIdeaPlugin
|
|
import org.springframework.gradle.propdeps.PropDepsPlugin;
|
|
|
|
/**
|
|
* @author Rob Winch
|
|
*/
|
|
public abstract class AbstractSpringJavaPlugin implements Plugin<Project> {
|
|
|
|
@Override
|
|
public final void apply(Project project) {
|
|
PluginManager pluginManager = project.getPluginManager();
|
|
pluginManager.apply(JavaPlugin.class);
|
|
pluginManager.apply(ManagementConfigurationPlugin.class)
|
|
if (project.file("src/main/groovy").exists()
|
|
|| project.file("src/test/groovy").exists()
|
|
|| project.file("src/integration-test/groovy").exists()) {
|
|
pluginManager.apply(GroovyPlugin.class);
|
|
}
|
|
pluginManager.apply("io.spring.convention.repository");
|
|
pluginManager.apply(EclipseWtpPlugin);
|
|
pluginManager.apply(IdeaPlugin);
|
|
pluginManager.apply(PropDepsPlugin);
|
|
pluginManager.apply(PropDepsEclipsePlugin);
|
|
pluginManager.apply(PropDepsIdeaPlugin);
|
|
pluginManager.apply("io.spring.convention.tests-configuration");
|
|
pluginManager.apply("io.spring.convention.integration-test");
|
|
pluginManager.apply("io.spring.convention.javadoc-options");
|
|
pluginManager.apply("io.spring.convention.checkstyle");
|
|
pluginManager.apply(CopyPropertiesPlugin);
|
|
pluginManager.apply("io.spring.convention.eclipse");
|
|
|
|
project.jar {
|
|
manifest.attributes["Created-By"] =
|
|
"${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
|
|
manifest.attributes["Implementation-Title"] = project.name
|
|
manifest.attributes["Implementation-Version"] = project.version
|
|
manifest.attributes["Automatic-Module-Name"] = project.name.replace('-', '.')
|
|
}
|
|
project.test {
|
|
useJUnitPlatform()
|
|
}
|
|
additionalPlugins(project);
|
|
}
|
|
|
|
protected abstract void additionalPlugins(Project project);
|
|
}
|