Closed cuifuan closed 5 years ago
你好,我理解的你的需求是单独为某个module进行build出jar包吧?
可以直接进入到指定的module路径内执行gradle build
命令,构建输出的jar包在build/libs内。
以api-gateway/zuul为例:
happyyangyuan:springcloud-quickstart happyyangyuan$ cd api-gateway/zuul/
happyyangyuan:zuul happyyangyuan$ gradle build
include :api-gateway:zuul
include :config:config-reader-with-bus
include :config:config-reader-with-bus0
include :config:config-reader
include :config:config-server
include :discovery:eureka-demo-client
include :discovery:eureka-server
include :discovery:eureka-demo-client0
include :call-chain:zipkin-clients:zipkin-client
include :call-chain:zipkin-clients:zipkin-client1
include :call-chain:zipkin-clients:zipkin-client0
include :call-chain:zipkin-server
include :routing:routing-feign
include :routing:routing-ribbon
BUILD SUCCESSFUL in 3s
5 actionable tasks: 3 executed, 2 up-to-date
happyyangyuan:zuul happyyangyuan$ ls build/libs/
zuul-0.0.1-SNAPSHOT.jar zuul-0.0.1-SNAPSHOT.jar.original
happyyangyuan:zuul happyyangyuan$ java -jar build/libs/zuul-0.0.1-SNAPSHOT.jar
2019-02-15 10:47:20.929 INFO 50767 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@48533e64: startup date [Fri Feb 15 10:47:20 CST 2019]; root of context hierarchy
2019-02-15 10:47:21.582 INFO 50767 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-02-15 10:47:21.802 INFO 50767 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$3c5b44cd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.8.RELEASE)
目前在根目录内执行gradle build
确实还有些问题,那种空的父module构建时会报错提示Could not set unknown property 'mainClassName' for project ':api-gateway'
,这个需要在build.gradle内指定这种空的父module直接跳过构建步骤才行,我后面有时间的话会补上这个gradle脚本。
好的,谢谢 !
我想分开module打包分开部署,现在就是打包之后找不到依赖