spring-cloud / spring-cloud-build

Common build concerns, shared plugin configuration, etc. for Spring Cloud modules
Apache License 2.0
198 stars 284 forks source link

Use maven wrapper script to avoid issues with maven version and repository paths #12

Closed ilayaperumalg closed 9 years ago

ilayaperumalg commented 9 years ago

I am using maven 3.2.2 and running mvn install -s .settings.xml and that resulted in missing dependencies

ERROR]   The project org.springframework.cloud:spring-cloud-config:1.1.0.BUILD-SNAPSHOT (/Users/igopinatha/workspace/git/ilayaperumalg/spring-cloud-config/pom.xml) has 6 errors
[ERROR]     Non-resolvable import POM: Failure to find org.springframework:spring-framework-bom:pom:4.2.0.RC2 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT, /Users/igopinatha/.m2/repository/org/springframework/boot/spring-boot-dependencies/1.3.0.BUILD-SNAPSHOT/spring-boot-dependencies-1.3.0.BUILD-SNAPSHOT.pom, line 1593, column 16 -> [Help 2]
[ERROR]     Non-resolvable import POM: Failure to find org.springframework.data:spring-data-releasetrain:pom:Gosling-M1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT, /Users/igopinatha/.m2/repository/org/springframework/boot/spring-boot-dependencies/1.3.0.BUILD-SNAPSHOT/spring-boot-dependencies-1.3.0.BUILD-SNAPSHOT.pom, line 1666, column 16 -> [Help 2]
[ERROR]     Non-resolvable import POM: Failure to find org.springframework.integration:spring-integration-bom:pom:4.2.0.M2 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT, /Users/igopinatha/.m2/repository/org/springframework/boot/spring-boot-dependencies/1.3.0.BUILD-SNAPSHOT/spring-boot-dependencies-1.3.0.BUILD-SNAPSHOT.pom, line 1678, column 16 -> [Help 2]
[ERROR]     Non-resolvable import POM: Failure to find org.springframework:spring-framework-bom:pom:4.2.0.RC2 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT, /Users/igopinatha/.m2/repository/org/springframework/boot/spring-boot-dependencies/1.3.0.BUILD-SNAPSHOT/spring-boot-dependencies-1.3.0.BUILD-SNAPSHOT.pom, line 1593, column 16 -> [Help 2]
[ERROR]     Non-resolvable import POM: Failure to find org.springframework.data:spring-data-releasetrain:pom:Gosling-M1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT, /Users/igopinatha/.m2/repository/org/springframework/boot/spring-boot-dependencies/1.3.0.BUILD-SNAPSHOT/spring-boot-dependencies-1.3.0.BUILD-SNAPSHOT.pom, line 1666, column 16 -> [Help 2]
[ERROR]     Non-resolvable import POM: Failure to find org.springframework.integration:spring-integration-bom:pom:4.2.0.M2 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT, /Users/igopinatha/.m2/repository/org/springframework/boot/spring-boot-dependencies/1.3.0.BUILD-SNAPSHOT/spring-boot-dependencies-1.3.0.BUILD-SNAPSHOT.pom, line 1678, column 16 -> [Help 2]

After upgrading maven to 3.3.3, the build ran successfully

Please note I ran this on spring-cloud-config project.

spencergibb commented 9 years ago

Perhaps we could use maven-wrapper, which is similar to gradle wrapper, to avoid these problems. @dsyer @philwebb what do you think?

philwebb commented 9 years ago

That looks interesting. I've not experience of using it but I do like using the Gradle wrapper.

spencergibb commented 9 years ago

@jvanzyl added a license (ASL) https://twitter.com/jvanzyl/status/621009788315418624 and I added it to my sample project https://github.com/spencergibb/myfeed/commit/26b80864c50a7f953ff9a772edf5c1796ce6b32c, it's almost exactly like gradle wrapper. Looks simple and could simplify our contributing requirements to just java :-)

jvanzyl commented 9 years ago

It was originally copied from the GradleWrapper by @bdemers and I updated it for newer versions of Maven and started adding more features. More info can be found here:

https://github.com/takari/maven-wrapper

jvanzyl commented 9 years ago

I gave full credit to the Gradle folks :-)

thesrinivas commented 9 years ago

I'm getting this build failure with ./build.sh after a fresh clone. This is on a CentOS 7. I've installed mvm, java

[root]# mvn -version
Apache Maven 3.0.5 (Red Hat 3.0.5-16)
Maven home: /usr/share/maven
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-229.7.2.el7.x86_64", arch: "amd64", family: "unix"
[root]# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)

[root]# ./build.sh
...
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring Cloud Config 1.1.0.BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spring-cloud-config ---
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:exec (imports) @ spring-cloud-config ---
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.14:check (enforce-java-7) @ spring-cloud-config ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java17:1.0
[INFO]
[INFO] --- maven-javadoc-plugin:2.10.1:jar (javadoc) @ spring-cloud-config ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] >>> maven-source-plugin:2.4:jar (attach-sources) @ spring-cloud-config >>>
[INFO]
[INFO] <<< maven-source-plugin:2.4:jar (attach-sources) @ spring-cloud-config <<<
[INFO]
[INFO] --- maven-source-plugin:2.4:jar (attach-sources) @ spring-cloud-config ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ spring-cloud-config ---
[INFO] Installing /root/spring-cloud-samples/scripts/config/pom.xml to /root/.m2/repository/org/springframework/cloud/spring-cloud-config/1.1.0.BUILD-SNAPSHOT/spring-cloud-config-1.1.0.BUILD-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring Cloud Config Client 1.1.0.BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spring-cloud-config-client ---
[INFO] Deleting /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/target
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:exec (imports) @ spring-cloud-config-client ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-cloud-config-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ spring-cloud-config-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[23,40] package com.fasterxml.jackson.annotation does not exist
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[24,40] package com.fasterxml.jackson.annotation does not exist
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[21,40] package com.fasterxml.jackson.annotation does not exist
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[22,40] package com.fasterxml.jackson.annotation does not exist
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[49,29] cannot find symbol
  symbol:   class JsonProperty
  location: class org.springframework.cloud.config.environment.Environment
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[50,26] cannot find symbol
  symbol:   class JsonProperty
  location: class org.springframework.cloud.config.environment.Environment
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[51,26] cannot find symbol
  symbol:   class JsonProperty
  location: class org.springframework.cloud.config.environment.Environment
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[48,10] cannot find symbol
  symbol:   class JsonCreator
  location: class org.springframework.cloud.config.environment.Environment
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[39,32] cannot find symbol
  symbol:   class JsonProperty
  location: class org.springframework.cloud.config.environment.PropertySource
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[40,26] cannot find symbol
  symbol:   class JsonProperty
  location: class org.springframework.cloud.config.environment.PropertySource
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[38,10] cannot find symbol
  symbol:   class JsonCreator
  location: class org.springframework.cloud.config.environment.PropertySource
[INFO] 11 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Spring Cloud Commons Parent ....................... SUCCESS [1.427s]
[INFO] Spring Cloud Context .............................. SUCCESS [6.675s]
[INFO] Spring Cloud Commons .............................. SUCCESS [3.864s]
[INFO] spring-cloud-starter .............................. SUCCESS [0.685s]
[INFO] Spring Cloud Commons Docs ......................... SUCCESS [0.412s]
[INFO] Spring Cloud Config ............................... SUCCESS [0.430s]
[INFO] Spring Cloud Config Client ........................ FAILURE [0.307s]
[INFO] spring-cloud-config-server ........................ SKIPPED
[INFO] spring-cloud-config-sample ........................ SKIPPED
[INFO] spring-cloud-starter-config ....................... SKIPPED
[INFO] Spring Cloud Config Docs .......................... SKIPPED
[INFO] Spring Cloud Netflix .............................. SKIPPED
[INFO] Spring Cloud Netflix Core ......................... SKIPPED
[INFO] Spring Cloud Netflix Hystrix ...................... SKIPPED
[INFO] Spring Cloud Netflix Hystrix AMQP ................. SKIPPED
[INFO] Spring Cloud Netflix Eureka Server ................ SKIPPED
[INFO] Spring Cloud Netflix Turbine ...................... SKIPPED
[INFO] Spring Cloud Netflix Turbine AMQP ................. SKIPPED
[INFO] Spring Cloud Netflix Sidecar ...................... SKIPPED
[INFO] spring-cloud-starter-ribbon ....................... SKIPPED
[INFO] spring-cloud-starter-eureka ....................... SKIPPED
[INFO] spring-cloud-starter-eureka-server ................ SKIPPED
[INFO] spring-cloud-starter-feign ........................ SKIPPED
[INFO] spring-cloud-starter-hystrix ...................... SKIPPED
[INFO] spring-cloud-starter-hystrix-dashboard ............ SKIPPED
[INFO] spring-cloud-starter-turbine ...................... SKIPPED
[INFO] spring-cloud-starter-turbine-amqp ................. SKIPPED
[INFO] spring-cloud-starter-zuul ......................... SKIPPED
[INFO] Spring Cloud Netflix Docs ......................... SKIPPED
[INFO] Spring Cloud security Parent ...................... SKIPPED
[INFO] spring-cloud-security ............................. SKIPPED
[INFO] spring-cloud-starter-security ..................... SKIPPED
[INFO] spring-cloud-starter-oauth2 ....................... SKIPPED
[INFO] Spring Cloud Security Docs ........................ SKIPPED
[INFO] Spring Cloud AWS .................................. SKIPPED
[INFO] Spring Cloud AWS Core Module ...................... SKIPPED
[INFO] Spring Cloud AWS Context Module ................... SKIPPED
[INFO] Spring Cloud AWS Jdbc Module ...................... SKIPPED
[INFO] Spring Cloud AWS Messaging Module ................. SKIPPED
[INFO] Spring Cloud AWS Autoconfigure .................... SKIPPED
[INFO] spring-cloud-starter-aws .......................... SKIPPED
[INFO] spring-cloud-starter-aws-jdbc ..................... SKIPPED
[INFO] spring-cloud-starter-aws-messaging ................ SKIPPED
[INFO] Spring Cloud AWS Docs ............................. SKIPPED
[INFO] spring-cloud-bus-parent ........................... SKIPPED
[INFO] spring-cloud-bus .................................. SKIPPED
[INFO] spring-cloud-starter-bus-amqp ..................... SKIPPED
[INFO] Spring Cloud Bus Docs ............................. SKIPPED
[INFO] spring-cloud-starter-parent ....................... SKIPPED
[INFO] Spring Cloud Starter Docs ......................... SKIPPED
[INFO] Spring Cloud Starter Build ........................ SKIPPED
[INFO] Spring Cloud Cli Parent ........................... SKIPPED
[INFO] Spring Cloud Versions ............................. SKIPPED
[INFO] spring-cloud-cli .................................. SKIPPED
[INFO] Spring Cloud Cli Docs ............................. SKIPPED
[INFO] Spring Cloud Samples Scripts ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.781s
[INFO] Finished at: Tue Jul 14 06:13:38 PDT 2015
[INFO] Final Memory: 117M/781M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project spring-cloud-config-client: Compilation failure: Compilation failure:
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[23,40] package com.fasterxml.jackson.annotation does not exist
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[24,40] package com.fasterxml.jackson.annotation does not exist
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[21,40] package com.fasterxml.jackson.annotation does not exist
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[22,40] package com.fasterxml.jackson.annotation does not exist
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[49,29] cannot find symbol
[ERROR] symbol:   class JsonProperty
[ERROR] location: class org.springframework.cloud.config.environment.Environment
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[50,26] cannot find symbol
[ERROR] symbol:   class JsonProperty
[ERROR] location: class org.springframework.cloud.config.environment.Environment
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[51,26] cannot find symbol
[ERROR] symbol:   class JsonProperty
[ERROR] location: class org.springframework.cloud.config.environment.Environment
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/Environment.java:[48,10] cannot find symbol
[ERROR] symbol:   class JsonCreator
[ERROR] location: class org.springframework.cloud.config.environment.Environment
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[39,32] cannot find symbol
[ERROR] symbol:   class JsonProperty
[ERROR] location: class org.springframework.cloud.config.environment.PropertySource
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[40,26] cannot find symbol
[ERROR] symbol:   class JsonProperty
[ERROR] location: class org.springframework.cloud.config.environment.PropertySource
[ERROR] /root/spring-cloud-samples/scripts/config/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/environment/PropertySource.java:[38,10] cannot find symbol
[ERROR] symbol:   class JsonCreator
[ERROR] location: class org.springframework.cloud.config.environment.PropertySource
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :spring-cloud-config-client
spencergibb commented 9 years ago

@thesrinivas can you create a new issue here https://github.com/spring-cloud-samples/scripts/issues

spencergibb commented 9 years ago

@jvanzyl Yes! It's one of the things I missed going back to maven.

bdemers commented 9 years ago

Great! I'm glad the maven-wrapper got picked up, I didn't want to see it die, but didn't have time to work on it. Thanks @jvanzyl !

dsyer commented 9 years ago

I think the only thing that prevents us from using the wrapper is the release process, which needs to have credentials in settings.xml so we can't put them in source control. If we could declare repositories using the wrapper and not using settings.xml, or if mvn -s ... was additive with settings, then we could switch.

dsyer commented 9 years ago

This is working now.