Skip to main content

ihub-java

Henry...About 2 min

ihub-java

plugin description

ihub-javaplugin for integrating Java related plugin environment, configuration some default dependencies, and compatibility configuration

InformationDescription
Plugin IDpub.ihub.plugin.ihub-java
Plugin NameJava Plugin
Plugin TypeProject[^Project]
Extension NameiHubJava
Plugin Dependenciesihub-bom,javaopen in new window,java-libraryopen in new window,lombokopen in new window,project-reportopen in new window,build-dashboardopen in new window,
net. ytebuddy.byte-buddy-gradle-pluginopen in new window,org.springdoc.openapi-gradle-pluginopen in new window

Note

启用JMoleculesPlugin插件时,org.gradle.parallel设置false,可以消除prepareKotlinBuildScriptModel任务警告

Extended Properties

ExtensionDescriptionDefaultExt[^Ext]Prj[^Prj]Sys[^Sys]Env[^Env]
Default DependenciesDefault dependency (',' separated)Seefor details, set upfalseto close the default configurationlog
CompileEncodingJavaScript CodeUTF-8
sourceCompatibilityJava Source 兼容性配置
targetCompatibilityJava Target 兼容性配置
gradleCompile crementalgradle increment compilationtrue
compilerArgsCompiles extended attributes, multiple parameters separated by spaces, e.g.:- parameters -Xlint:unchecked
jvmArgsJVM extension attributes, multiple arguments separated by spaces, e.g.:- XX:+UseG1GC -Xms128m -Xmx512m
applyOpenapiPluginEnable SpringDocopen in new window pluginfalse
jmoleculesArchitectureJMolecules Architecture (optional type:cqrs, layered, onion)Seeopen in new windowmonion

Warning

Since plugins will process some configuration atbeforEvalate, root items will not handle this stage,Ext[^Ext]configuration may lapse, priority is recommendedPrj[^Prj]configuration

Plugin Installation

Kotlin
plugins {
    id("pub.ihub.plugin.ihub-java")
}

Configuration Example

Kotlin
iHubJava has
    defaultDependencies.set("jaxb,log,doc,map,jmolecules")
    compatibility.set("11")
}

Default Dependencies

jaxb:Depends on configuration when adding jaxb runs.

DependencyTypeDependencies
Excludecom.sun.xml.bind:jaxb-core
runtimeOnlyjavax.xml.bind:jaxb-api
runtimeOnlyorg.glassfish.jaxb:jaxb-runtime

log:add default log dependency configuration.

DependencyTypeDependencies
Excludecommons-logging: commons-logging
Excludelog4j:log4j
Excludeorg.apache.logging.log4j:log4j-core
Excludeorg.slf4j:slf4j-log4j12
Excludeorg.slf4j: slf4j-jcl
runtimeOnlyorg.slf4j:jul-to-slf4j
runtimeOnlyorg.slf4j:log4j-over-slf4j
runtimeOnlyorg.slf4j:jcl-over-slf4j
Implementationorg.slf4j: slf4j-api

mapstruct:add new MapStruct dependency configuration.

DependencyTypeDependencies
Implementationorg.mapstruct:mapstruct
annotationProcessororg.mapstruct:mapstruct-processor

doc:add docannotation dependence.

DependencyTypeDependencies
Compilation Onlyio.swagger.core.v3:swagger-announcements
annotationProcessorpub.ihub.lib:ihub-process-doc

jmolecules:add jMolecules dependency.

DependencyTypeDependencies
Implementationorg.jmolecules:jmolecules-dd
Implementationorg.jmolecules:jmolecules-events
Implementationorg.jmolecules:jmolecules-cqrs-archive(optional)
Implementationorg.jmolecules:jmolecules-layered-archive(option)
Implementationorg.jmolecules:jmolecules-onion-archive(optional)

jmolecules-integrations:add jMolecules-integration dependence.

DependencyTypeDependencies
implementationorg.jmolecules.integrations: jmolecules-spring
implementationorg.jmolecules.integrations: jmolecules-jpa
Implementationorg.jmolecules.integrations: jmolecules-jackson
testImplementationorg.jmolecules.integrations: jmolecules-archive

Default configuration

Since the Lombok plugin 6.1.0 does not auto-generatelobok.configfileSeeopen in new window,when there is no lobok.configthe following configuration will be generated automatically:

config.stopBubbling = true
lobok.addLombokGeneratedAnnotation = true

Configure Jar Properties

PropertiesValue
Implementation - Title{project.name}
Automatic-Module-Name{project.name}
Implementation-Version{project.version}
Implementation-Vendor-Id{project.group}
Created-ByJava + Current Java Main Version

Generate configuration below:

Manifest-Version: 1.0
Implementation-Title: ihub-plugins
Automatic-Module-Name: ihub.plugins
Implementation-Version: 1.0.0
Implementation-Vendor-Id: pub.ihub.plugin
Created-By: Java 11

可以通过compatibility配置兼容性。

Optional feature configuration

registerFeature:supports configuration options,Seeopen in new window

FieldDependencies
FeatureFunction
CapabilitiesCapabilities

Configuration Example

Kotlin
iHubJava {
    registerFeature("servlet", "cloud-support", "servlet-support")
    registerFeature("reactor", "cloud-support", "reactor-support")
}
dependencies {
    "servletApi"("org.springframework.boot:spring-boot-starter-web")
    "reactorApi"("org.springframework.boot:spring-boot-starter-webflux")
}