首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gradle Spring Boot:将根目录下的文件夹添加到jar

Gradle Spring Boot:将根目录下的文件夹添加到jar
EN

Stack Overflow用户
提问于 2018-04-14 18:46:08
回答 2查看 1.7K关注 0票数 3

因此,我在spring boot项目的根目录下有一个.ebextensions文件夹,当我在用于intellij.I的gradle插件中使用"bootpackage“时,这些文件不会包含在jar中。我正在Amazon Web服务上部署jar如何将这些文件包含在jar中?

我的build.gradle

代码语言:javascript
复制
buildscript {
ext {
    springBootVersion = '1.5.9.RELEASE'
}
repositories {
    mavenCentral()
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}

apply plugin: 'java'
 apply plugin: 'eclipse'
 apply plugin: 'org.springframework.boot'

 group = 'haughton.daniel'
version = '0.0.1-SNAPSHOT'
  sourceCompatibility = 1.8

repositories {
mavenCentral()
}


ext {
springCloudVersion = 'Edgware.SR1'
}



 dependencies {
//compile 'org.springframework.cloud:spring-cloud-starter-aws'
compile('org.springframework.boot:spring-boot-starter-data-jpa')
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-mail
compile group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version: '2.0.0.RELEASE'

compile('org.springframework.boot:spring-boot-starter-jdbc')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
// https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity4
compile group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-springsecurity4', version: '2.1.2.RELEASE'

// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-aws-autoconfigure
//compile group: 'org.springframework.cloud', name: 'spring-cloud-aws-autoconfigure', version: '1.2.2.RELEASE'
// https://mvnrepository.com/artifact/mysql/mysql-connector-java
// https://mvnrepository.com/artifact/mysql/mysql-connector-java
compile group: 'mysql', name: 'mysql-connector-java', version: '6.0.6'


compile('org.springframework.boot:spring-boot-starter-web')
compile ('org.apache.tomcat:tomcat-dbcp:8.0.30')

runtime('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.security:spring-security-test')
}

dependencyManagement {
imports {
    mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
EN

回答 2

Stack Overflow用户

发布于 2018-04-14 19:19:01

解决方案:将此代码添加到我的build.gradle

代码语言:javascript
复制
processResources {
from ('.ebextensions/') {
    into '.ebextensions'
}
}
票数 3
EN

Stack Overflow用户

发布于 2019-01-31 15:55:09

我在我的项目源代码中添加了一个ebextensions文件夹,其中包含带有nginx配置的.ebextensions文件夹:

文件夹结构

我扩展了bootJar任务:

代码语言:javascript
复制
bootJar {
   baseName = 'project'
   version = '1.0.0'
   from('ebextensions')
   //...

当我运行./gradlew cle ass bootJar时,解压缩后的项目-1.0.0.jar包含:

  • .ebextensions
  • BOOT-INF
  • META-INF
  • org

我使用的是Gradle 4.10。

根本原因是ElasticBeanstalk的413请求实体太大。

Proxy.conf的完整内容:

代码语言:javascript
复制
client_max_body_size 20M;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49830570

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档