diff --git a/pom.xml b/pom.xml index 0ce04ad..4ace128 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,6 @@ ${basedir}/.. - spring-cloud-versions spring-cloud-cli docs diff --git a/spring-cloud-cli/pom.xml b/spring-cloud-cli/pom.xml index 1a5ce56..1004dc6 100644 --- a/spring-cloud-cli/pom.xml +++ b/spring-cloud-cli/pom.xml @@ -31,7 +31,6 @@ org.springframework.cloud spring-cloud-stream - ${spring-cloud-stream.version} true @@ -45,49 +44,8 @@ UTF-8 1.7 ${project.version} - 1.0.0.BUILD-SNAPSHOT - ${project.build.directory}/generated-resources/org/springframework/cloud/cli/compiler - - - - ${basedir}/src/main/resources - - - ${project.build.directory}/generated-resources - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-effective-pom - generate-resources - - copy - - - - - org.springframework.cloud - spring-cloud-versions - ${spring-cloud.version} - effective-pom - true - ${generated.pom.dir} - effective-pom.xml - - - - - - - - - milestone diff --git a/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/EurekaServerAstTransformation.java b/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/EurekaServerAstTransformation.java deleted file mode 100644 index 83a6ccc..0000000 --- a/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/EurekaServerAstTransformation.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2013-2014 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 - * - * http://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 org.springframework.cloud.cli.compiler; - -import groovy.lang.GrabExclude; - -import org.codehaus.groovy.ast.ASTNode; -import org.codehaus.groovy.ast.AnnotationNode; -import org.codehaus.groovy.ast.ClassHelper; -import org.codehaus.groovy.ast.ClassNode; -import org.codehaus.groovy.ast.ModuleNode; -import org.codehaus.groovy.ast.PackageNode; -import org.codehaus.groovy.ast.expr.ConstantExpression; -import org.codehaus.groovy.control.CompilePhase; -import org.codehaus.groovy.control.SourceUnit; -import org.codehaus.groovy.transform.ASTTransformation; -import org.codehaus.groovy.transform.GroovyASTTransformation; - -/** - * @author Dave Syer - * - */ -@GroovyASTTransformation(phase = CompilePhase.CONVERSION) -public class EurekaServerAstTransformation implements ASTTransformation { - - @Override - public void visit(ASTNode[] nodes, SourceUnit source) { - for (ASTNode astNode : nodes) { - if (astNode instanceof ModuleNode) { - visitModule((ModuleNode) astNode); - } - } - } - - private void visitModule(ModuleNode module) { - AnnotationNode exclude = new AnnotationNode(ClassHelper.make(GrabExclude.class)); - exclude.addMember("value", new ConstantExpression( - "org.qos.logback:logback-classic")); - PackageNode pkg = module.getPackage(); - if (pkg != null) { - pkg.addAnnotation(exclude); - } else if (!module.getClasses().isEmpty()){ - ClassNode node = module.getClasses().get(0); - node.addAnnotation(exclude); - } - } - -} diff --git a/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/SpringCloudBomAstTransformation.java b/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/SpringCloudBomAstTransformation.java new file mode 100644 index 0000000..50c9f12 --- /dev/null +++ b/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/SpringCloudBomAstTransformation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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 + * + * http://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 org.springframework.cloud.cli.compiler; + +import org.codehaus.groovy.control.CompilePhase; +import org.codehaus.groovy.transform.GroovyASTTransformation; +import org.springframework.boot.cli.compiler.DependencyManagementBomTransformation; +import org.springframework.boot.cli.compiler.GenericBomAstTransformation; + +/** + * @author Dave Syer + * + */ +@GroovyASTTransformation(phase = CompilePhase.CONVERSION) +public class SpringCloudBomAstTransformation extends GenericBomAstTransformation { + + private static final String SPRING_CLOUD_VERSION = "Brixton.BUILD-SNAPSHOT"; + + @Override + protected String getBomModule() { + return "org.springframework.cloud:spring-cloud-starter-parent:" + SPRING_CLOUD_VERSION; + } + + @Override + public int getOrder() { + return DependencyManagementBomTransformation.ORDER - 50; + } + +} diff --git a/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/SpringCloudCompilerAutoConfiguration.java b/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/SpringCloudCompilerAutoConfiguration.java index 8f1cf19..66446e2 100644 --- a/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/SpringCloudCompilerAutoConfiguration.java +++ b/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/SpringCloudCompilerAutoConfiguration.java @@ -15,23 +15,10 @@ */ package org.springframework.cloud.cli.compiler; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.maven.model.Model; -import org.apache.maven.model.building.DefaultModelProcessor; -import org.apache.maven.model.io.DefaultModelReader; -import org.apache.maven.model.locator.DefaultModelLocator; import org.codehaus.groovy.control.CompilationFailedException; import org.codehaus.groovy.control.customizers.ImportCustomizer; import org.springframework.boot.cli.compiler.CompilerAutoConfiguration; import org.springframework.boot.cli.compiler.DependencyCustomizer; -import org.springframework.boot.cli.compiler.dependencies.Dependency; -import org.springframework.boot.cli.compiler.dependencies.MavenModelDependencyManagement; /** * @author Dave Syer @@ -42,7 +29,6 @@ public class SpringCloudCompilerAutoConfiguration extends @Override public void applyDependencies(DependencyCustomizer dependencies) { - addManagedDependencies(dependencies); dependencies .ifAnyMissingClasses( "org.springframework.boot.actuate.endpoint.EnvironmentEndpoint") @@ -58,82 +44,4 @@ public class SpringCloudCompilerAutoConfiguration extends imports.addImports("org.springframework.cloud.context.config.annotation.RefreshScope"); } - private void addManagedDependencies(DependencyCustomizer dependencies) { - dependencies.getDependencyResolutionContext().addDependencyManagement(new SpringCloudDependenciesDependencyManagement()); - - } - - public static class SpringCloudDependenciesDependencyManagement extends - MavenModelDependencyManagement { - - public SpringCloudDependenciesDependencyManagement() { - super(readModel()); - } - - private static Model readModel() { - DefaultModelProcessor modelProcessor = new DefaultModelProcessor(); - modelProcessor.setModelLocator(new DefaultModelLocator()); - modelProcessor.setModelReader(new DefaultModelReader()); - - try { - return modelProcessor - .read(SpringCloudDependenciesDependencyManagement.class - .getResourceAsStream("effective-pom.xml"), null); - } catch (IOException ex) { - throw new IllegalStateException( - "Failed to build model from effective pom", ex); - } - } - - } - - static class AetherManagedDependencies implements Iterable { - - private Map groupAndArtifactToDependency = new HashMap(); - - private Map artifactToGroupAndArtifact = new HashMap(); - - public AetherManagedDependencies(List dependencies) { - - for (Dependency dependency : dependencies) { - - String groupId = dependency.getGroupId(); - String artifactId = dependency.getArtifactId(); - String version = dependency.getVersion(); - - List exclusions = new ArrayList(); - Dependency value = new Dependency(groupId, artifactId, version, - exclusions); - - groupAndArtifactToDependency.put(groupId + ":" + artifactId, - value); - artifactToGroupAndArtifact.put(artifactId, groupId + ":" - + artifactId); - - } - - } - - // @Override - public Dependency find(String groupId, String artifactId) { - return groupAndArtifactToDependency.get(groupId + ":" + artifactId); - } - - // @Override - public Dependency find(String artifactId) { - String groupAndArtifact = artifactToGroupAndArtifact - .get(artifactId); - if (groupAndArtifact == null) { - return null; - } - return groupAndArtifactToDependency.get(groupAndArtifact); - } - - @Override - public Iterator iterator() { - return groupAndArtifactToDependency.values().iterator(); - } - - } - } diff --git a/spring-cloud-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.SpringBootAstTransformation b/spring-cloud-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.SpringBootAstTransformation index aa1ea4e..accdfba 100644 --- a/spring-cloud-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.SpringBootAstTransformation +++ b/spring-cloud-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.SpringBootAstTransformation @@ -1,3 +1 @@ -# TODO: maybe it need package change to org.springframework.boot.groovy.cloud as well? -# TODO: test this is working once Boot 1.1.6 is out -# org.springframework.cloud.cli.compiler.EurekaServerAstTransformation \ No newline at end of file +org.springframework.cloud.cli.compiler.SpringCloudBomAstTransformation \ No newline at end of file diff --git a/spring-cloud-versions/pom.xml b/spring-cloud-versions/pom.xml deleted file mode 100644 index 11492ad..0000000 --- a/spring-cloud-versions/pom.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud - spring-cloud-cli-parent - 1.1.0.BUILD-SNAPSHOT - - spring-cloud-versions - pom - Spring Cloud Versions - Spring Cloud Versions Property File - http://projects.spring.io/spring-cloud/ - - Pivotal Software, Inc. - http://www.spring.io - - - ${basedir}/../.. - Brixton.BUILD-SNAPSHOT - - - - - org.springframework.cloud - spring-cloud-starter-parent - ${spring-cloud.version} - pom - import - - - - - - - ${project.build.directory}/generated-resources - - - - - maven-help-plugin - - - generate-effective-dependencies-pom - generate-resources - - effective-pom - - - ${project.build.directory}/effective-pom/spring-cloud-versions.xml - - - - - - org.codehaus.mojo - xml-maven-plugin - 1.0 - - - - transform - - - - - - - ${project.build.directory}/effective-pom - src/main/xslt/dependency-management-to-versions.xsl - - - .properties - - - ${project.build.directory}/generated-resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - package - - attach-artifact - - - - - ${project.build.directory}/generated-resources/spring-cloud-versions.properties - properties - - - ${project.build.directory}/effective-pom/spring-cloud-versions.xml - effective-pom - - - - - - attach-zip - - - - - - - diff --git a/spring-cloud-versions/src/dependency-tree/settings.xml b/spring-cloud-versions/src/dependency-tree/settings.xml deleted file mode 100644 index e1e0ace..0000000 --- a/spring-cloud-versions/src/dependency-tree/settings.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - it-repo - - true - - - - local.central - @localRepositoryUrl@ - - true - - - true - - - - - - local.central - @localRepositoryUrl@ - - true - - - true - - - - - - diff --git a/spring-cloud-versions/src/main/xslt/dependency-management-to-versions.xsl b/spring-cloud-versions/src/main/xslt/dependency-management-to-versions.xsl deleted file mode 100644 index 905c15a..0000000 --- a/spring-cloud-versions/src/main/xslt/dependency-management-to-versions.xsl +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - \: - - = - - - - - - \ No newline at end of file