- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对 Gradle 生命周期有一个基本的询问。我的项目是一个多模块项目。
我注意到以下命令:
./gradlew clean bignibou-server:run
./gradlew clean
./gradlew bignibou-server:run
bignibou-server
是我的模块之一。
xây dựng.gradle
:
import io.franzbecker.gradle.lombok.task.DelombokTask
def javaVersion = 1.8
xây dựng kịch bản {
kho lưu trữ {
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
maven { url "https://plugins.gradle.org/m2/" }
}
phần mở rộng {
javaLanguageLevel = '1.8'
}
ext['mockito.version'] = "${mockitoVersion}"
ext['hibernate.version'] = "${hibernateVersion}"
phụ thuộc {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("io.franzbecker:gradle-lombok:${gradleLombokVersion}")
}
}
configure(allprojects) { project ->
group = "com.bignibou"
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
configurations {
mapstruct
}
kho lưu trữ {
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
maven { url "https://artifacts.elastic.co/maven" }
}
compileJava {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
test {
reports.html.destination = file("$reports.html.destination/unit")
reports.junitXml.destination = file("$reports.junitXml.destination/unit")
}
task delombok(type: DelombokTask) {
ext.outputDir = file("$buildDir/src-delomboked/java")
outputs.dir(outputDir)
sourceSets.main.java.srcDirs.each {
inputs.dir(it)
args(it, "-d", outputDir)
}
}
// FIXME: refactor paths to generated sources
task mapStructClean {
delete file("build/generated-sources/mapstruct/main")
}
task generateMainMapperClasses(type: JavaCompile, group: 'build') {
ext.aptDumpDir = file("${buildDir}/tmp/apt/mapstruct")
destinationDir = aptDumpDir
classpath = compileJava.classpath + configurations.mapstruct
source = file("$buildDir/src-delomboked/java")
ext.sourceDestDir = file("build/generated-sources/mapstruct/main")
options.define(
compilerArgs: [
"-nowarn",
"-proc:only",
"-encoding", "UTF-8",
"-processor", "org.mapstruct.ap.MappingProcessor" + ',lombok.launch.AnnotationProcessorHider$AnnotationProcessor',
"-s", sourceDestDir.absolutePath,
"-source", rootProject.javaLanguageLevel,
"-target", rootProject.javaLanguageLevel,
]
);
inputs.dir source
outputs.dir "${buildDir}/generated-sources/mapstruct/main"
doFirst {
sourceDestDir.mkdirs()
}
doLast {
aptDumpDir.delete()
}
}
}
task wrapper(type: Wrapper) { gradleVersion = '3.5' }
bignibou-commmon
模块:
description = "Bignibou Common"
apply plugin: 'org.springframework.boot'
apply plugin: 'io.franzbecker.gradle-lombok'
configurations {
querydslapt
mapstruct
}
dependencyManagement {
phụ thuộc {
dependency "org.elasticsearch:elasticsearch:${elasticsearchVersion}"
}
}
phụ thuộc {
compile("org.springframework.boot:spring-boot-starter-data-jpa") {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
compile("org.springframework.boot:spring-boot-starter-mail")
compile('org.springframework.security:spring-security-core')
compile('org.hibernate:hibernate-validator')
compile("org.hibernate:hibernate-java8")
compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
//Spring cloud
compile("org.springframework.cloud:spring-cloud-spring-service-connector")
compile("org.springframework.cloud:spring-cloud-localconfig-connector")
compile("org.springframework.cloud:spring-cloud-cloudfoundry-connector")
// Relational Database
compile("org.postgresql:postgresql:${postgresqlVersion}")
compile("org.flywaydb:flyway-core")
// Connection pooling
compile("com.zaxxer:HikariCP")
//Shield
compile("org.elasticsearch.client:x-pack-transport:${elasticsearchVersion}")
compile("org.elasticsearch:elasticsearch:${elasticsearchVersion}")
compile("org.apache.logging.log4j:log4j-api")
compile("org.apache.logging.log4j:log4j-core")
// QueryDSL
compile("com.querydsl:querydsl-core:${queryDslVersion}")
compile("com.querydsl:querydsl-jpa:${queryDslVersion}")
querydslapt("com.querydsl:querydsl-apt:${queryDslVersion}")
// Jackson
compile("com.fasterxml.jackson.core:jackson-core")
compile("com.fasterxml.jackson.core:jackson-annotations")
compile("org.mapstruct:mapstruct-jdk8:${mapstructVersion}")
mapstruct("org.mapstruct:mapstruct-processor:${mapstructVersion}")
compile("org.apache.httpcomponents:httpclient:${httpClientVersion}")
compile("org.jasypt:jasypt:${jasyptVersion}")
}
sourceSets {
chủ yếu {
ext.originalJavaSrcDirs = java.srcDirs
java.srcDir "build/generated-sources/mapstruct/main"
output.dir("build/generated-mail-templates")
}
generated {
java {
srcDirs = ["build/generated-sources/java", "build/src-delomboked/java", "build/generated-sources/mapstruct/main"]
}
}
}
bootRepackage {
enabled = false
}
task generateQueryDSL(type: JavaCompile, group: 'build') {
description "Generates the QueryDSL query types"
source = sourceSets.main.java
classpath = configurations.compile + configurations.querydslapt
options.compilerArgs = [
"-proc:only",
"-processor",
"com.querydsl.apt.jpa.JPAAnnotationProcessor" + ',lombok.launch.AnnotationProcessorHider$AnnotationProcessor'
]
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
}
// FIXME: add cssFile &
// FIXME: add dependsOn processMailTemplates &
// FIXME: clean mail templates html
// FIXME: ensure build is stopped if templates are not processed
task npmInstall(type: Exec) {
description "npm install"
commandLine 'npm', 'install'
}
task processMailTemplates {
description "Processes mail templates"
dependsOn npmInstall
def templateSrcDir = "src/main/templates/mail/"
def templateDestDir = "build/generated-mail-templates/META-INF/templates/mail/"
mkdir templateDestDir
def templateNames = []
fileTree(dir: templateSrcDir, include: '**/*.html').visit {
FileVisitDetails details -> templateNames << details.file.name
}
templateNames.each { templateName -> inlineCss(templateSrcDir + templateName, templateDestDir + templateName) }
outputs.upToDateWhen { false }
}
static def inlineCss(src, dest) {
def juice = 'node_modules/.bin/juice'
def juiceResourcesDir = 'src/main/templates/misc/'
def juiceArgs = "--options-file ${juiceResourcesDir}juiceOptions.json --css ${juiceResourcesDir}mailStyle.css"
"${juice} ${juiceArgs} ${src} ${dest}".execute(null, new File('bignibou-common'))
}
compileJava {
dependsOn generateQueryDSL
source generateQueryDSL.destinationDir
}
compileGeneratedJava {
dependsOn generateQueryDSL
options.warnings = false
classpath += sourceSets.main.runtimeClasspath
}
idea {
module {
sourceDirs += file('build/generated-sources/java')
}
}
processResources.dependsOn processMailTemplates
compileJava.dependsOn generateMainMapperClasses
generateMainMapperClasses.dependsOn mapStructClean
generateMainMapperClasses.dependsOn delombok
clean {
delete sourceSets.generated.java.srcDirs
}
bignibou-server
模块:
description = "Bignibou Server"
configurations {
mapstruct
integrationTest
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
apply plugin: 'io.franzbecker.gradle-lombok'
apply plugin: 'org.springframework.boot'
apply plugin: 'application'
dependencyManagement {
phụ thuộc {
dependency "org.elasticsearch:elasticsearch:${elasticsearchVersion}"
}
}
phụ thuộc {
compile project(":bignibou-common")
compile project(":bignibou-client")
//Spring boot
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-data-jpa") {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
compile("org.springframework.boot:spring-boot-starter-data-redis") {
exclude group: 'redis.clients', module: 'jedis'
}
compile("biz.paluch.redis:lettuce:${lettuceVersion}")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-starter-cache")
// Miscellaneous
compile("commons-collections:commons-collections")
compile("org.apache.commons:commons-lang3:${commonLangVersion}")
mapstruct("org.mapstruct:mapstruct-processor:${mapstructVersion}")
//Caching
compile("org.hibernate:hibernate-ehcache")
compile("com.github.ben-manes.caffeine:caffeine:${caffeineVersion}")
// Spring Session
compile("org.springframework.session:spring-session")
// Testing
testCompile project(":bignibou-test")
}
run {
systemProperty "spring.cloud.propertiesFile", System.getProperty("user.dir") + "/spring-cloud.properties"
}
springBoot {
mainClassName = "com.bignibou.Application"
}
sourceSets {
chủ yếu {
ext.originalJavaSrcDirs = java.srcDirs
java.srcDir "build/generated-sources/mapstruct/main"
}
generated {
java {
srcDirs = ["build/src-delomboked/java", "build/generated-sources/mapstruct/main"]
}
}
integrationTest {
java.srcDirs = ['src/it/java']
resources.srcDirs = ['src/it/resources', 'src/main/resources']
compileClasspath = sourceSets.main.output + configurations.testRuntime
runtimeClasspath = output + compileClasspath
}
}
task integrationTest(type: Test) {
description "Run the integration tests."
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
reports.html.destination = file("$reports.html.destination/integration")
reports.junitXml.destination = file("$reports.junitXml.destination/integration")
}
compileJava.dependsOn generateMainMapperClasses
generateMainMapperClasses.dependsOn mapStructClean
generateMainMapperClasses.dependsOn delombok
check.dependsOn integrationTest
integrationTest.shouldRunAfter test
bignibou-common
模块):
build/generated-mail-templates
output.dir(...
之后调用(见下文),
build/generated-mail-templates
没有被删除,但不幸的是模板不包含在类路径中......
sourceSets {
chủ yếu {
ext.originalJavaSrcDirs = java.srcDirs
java.srcDir "build/generated-sources/mapstruct/main"
//output.dir("build/generated-mail-templates")
}
1 Câu trả lời
task processMailTemplates {
description "Processes mail templates"
dependsOn npmInstall
def templateSrcDir = "src/main/templates/mail/"
def templateDestDir = "build/generated-mail-templates/META-INF/templates/mail/"
mkdir templateDestDir
def templateNames = []
fileTree(dir: templateSrcDir, include: '**/*.html').visit {
FileVisitDetails details -> templateNames << details.file.name
}
templateNames.each { templateName -> inlineCss(templateSrcDir + templateName, templateDestDir + templateName) }
outputs.upToDateWhen { false }
}
task processMailTemplates {
description "Processes mail templates"
dependsOn npmInstall
outputs.upToDateWhen { false }
doLast {
def templateSrcDir = "src/main/templates/mail/"
def templateDestDir = "build/generated-mail-templates/META-INF/templates/mail/"
mkdir templateDestDir
def templateNames = []
fileTree(dir: templateSrcDir, include: '**/*.html').visit {
FileVisitDetails details -> templateNames << details.file.name
}
templateNames.each { templateName -> inlineCss(templateSrcDir + templateName, templateDestDir + templateName) }
}
}
关于gradle - 链接 gradle 任务和 gradle 生命周期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44199793/
Phương thức Task.WaitAll chờ tất cả các tác vụ, còn phương thức Task.WaitAny chờ một tác vụ. Làm sao để chờ đợi bất kỳ N tác vụ nào? Trường hợp sử dụng: Tải xuống một trang kết quả tìm kiếm, mỗi kết quả yêu cầu một tác vụ riêng để tải xuống và xử lý. Nếu tôi sử dụng WaitA
Tôi đang xem một số mã C# cũ trông như thế này: await Task.Run(() => { _logger.LogException(LogLevel.Error, mes
Làm thế nào để chạy tác vụ cron trong Linux? Sau phần Hỏi & Đáp này, tôi có tác vụ cron này để chạy - chỉ cần ghi một số thông tin vào tệp txt, // /var/www/cron.php $myfile = fo
Xin lỗi vì câu hỏi của người mới nhưng tôi muốn thực hiện ba nhiệm vụ theo trình tự và sử dụng hai vai trò trong sổ tay hướng dẫn: Nhiệm vụ Vai trò Nhiệm vụ Vai trò Nhiệm vụ Đây là những gì tôi có cho đến nay (nhiệm vụ, vai trò, nhiệm vụ): --- - tên: Nhiệm vụ Vai trò Nhiệm vụ ho
Tôi có một tác vụ tùy chỉnh phụ thuộc vào installDist - không chỉ để thực thi mà còn để xuất ra installDist: project.task('run', type: JavaExec, depends
Khi chạy lệnh gỡ cài đặt từ MSI được tạo bằng Wix, tôi cần phải buộc dừng tiến trình đang chạy ở chế độ nền trước khi nó cố gắng xóa bất kỳ tệp nào. Ứng dụng chính bao gồm một biểu tượng trên khay phản ánh quá trình giám sát các dịch vụ Windows cục bộ.
Tôi muốn viết một tác vụ Ant để tự động hóa tác vụ khởi động máy chủ và sau đó mở Internet Explorer bằng URL của ứng dụng của tôi. Rõ ràng là tôi phải thực hiện tác vụ startServer trước, sau đó là startApplic
Khi sử dụng ASP.NET 4.5, tôi đang cố gắng sử dụng cơ chế async/await mới. Tôi có một lớp triển khai IDataReader bao gồm trình đọc cụ thể của nhà cung cấp (như SqlDatareader). Tôi có một cái đơn giản
Sử dụng lệnh gradle tasks để nhận báo cáo về tất cả các tác vụ có sẵn. Có cách nào để thêm tham số vào lệnh này và lọc các tác vụ theo nhóm tác vụ không? Tôi muốn đưa ra một lệnh như gradle tasks group:Demo để lọc tất cả các tác vụ và
Có cách nào khác ngoài sshexec không? Nhiệm vụ thực hiện điều này là gì? Tôi biết bạn có thể sử dụng tác vụ sao chép tệp scp. Tuy nhiên, tôi cần thực hiện các thao tác khác, chẳng hạn như kiểm tra xem một số thư mục có tồn tại hay không rồi xóa chúng. Tôi muốn sử dụng một cái gì đó giống như điều kiện
Giả sử tôi có chuỗi - "D:\ApEx_Schema\Functions\new.sql@@\main\ONEVIEW_Integration\3" Tôi cần trích xuất nội dung sau vào biến diff - Tên tài liệu
Tôi cần viết một tác vụ ant để xác định xem một tệp có phải là tệp chỉ đọc hay không và sẽ thất bại nếu đúng như vậy. Tôi muốn tránh phải sử dụng bộ chọn tùy chỉnh để thực hiện việc này vì bản chất của hệ thống xây dựng của chúng tôi. Có ai có ý tưởng nào để thực hiện không? Tôi đang sử dụng ant 1.8 + ant-c
Đây là một vấn đề khoa học máy tính khá tổng quát và không dành riêng cho bất kỳ hệ điều hành hay khuôn khổ nào. Vì vậy, tôi hơi bối rối về chi phí liên quan đến việc chuyển đổi tác vụ trên nhóm luồng. Trong nhiều trường hợp, việc cung cấp cho mỗi tác vụ một luồng riêng là không hợp lý (chúng ta không muốn tạo quá nhiều luồng phần cứng).
Tôi đang sử dụng sổ tay hướng dẫn Ansible sau đây để tắt danh sách các máy chủ Ubuntu từ xa cùng một lúc: - hosts: my_hosts trở thành: yes remote_user: my_user
Làm thế nào để thay đổi thư mục làm việc hiện tại trong Ant? Tài liệu Ant không có nhiệm vụ nào và theo tôi, cách tốt nhất là không thay đổi thư mục làm việc hiện tại. Nhưng giả sử chúng ta vẫn muốn làm điều này – bạn sẽ làm thế nào? Cảm ơn bạn! Câu trả lời hay nhất
Có thể chạy cronjob ba ngày một lần không? Hoặc có thể là 10 lần một tháng. Câu trả lời tốt nhất là chạy ba ngày một lần - hoặc thường xuyên hơn vào cuối tháng. (Nếu tháng cuối cùng có 31 ngày, nó sẽ chạy trong 2 ngày liên tiếp.) 0 0 */3 * *
Làm thế nào để thực thi một công cụ được lưu trữ trong kho lưu trữ trong tác vụ Gradle? Trong trường hợp cụ thể của tôi, tôi đang xây dựng một ứng dụng Android bằng Gradle. Tôi đã thêm một tác vụ để mã hóa một số dữ liệu protobuf từ văn bản sang nhị phân
Dự án của tôi có cấu trúc sau: Root |- A |- C (phụ thuộc vào A) \- B (phụ thuộc vào A) Đối với tất cả các dự án con, chúng tôi sử dụng plugin của riêng mình để tạo tài nguyên: https://githu
Tôi đã thiết lập một cụm Hadoop với 4 nút, trong đó một nút đóng vai trò là NameNode cho HDFS cũng như nút chính Yarn. Nút này cũng là nút mạnh nhất. Bây giờ, tôi đã phân phối 2 tệp văn bản, một trên node01 (tên node) và một trên node
Cách tốt nhất để lưu trữ tác vụ cho nhiều người dùng trong TFS 2010 là gì? Tôi chỉ có thể giao một nhiệm vụ cho một người. (Ví dụ: Khi tôi lên kế hoạch demo cho tất cả các nhà phát triển) (Đây là dự án Scrum Msf Agile trong đó các nhiệm vụ là một phần của câu chuyện người dùng)
Tôi là một lập trình viên xuất sắc, rất giỏi!