Skip to content

This is a plugin for gradle allows to create modules to be able to use them under JBoss 7.x/8.x

License

Notifications You must be signed in to change notification settings

mark-vieira/gradle-jboss-modules-plugin

 
 

Repository files navigation

gradle-jboss-modules-plugin

Build Status Coverage Status


This plugin for gradle allows to create modules to be able to use them under JBoss 7.x/8.x
The standard plugin 'distribution' generates archives for every servers which were defined in the project.


The main idea is to have an ability to make JBoss Modules

How to install

See Gradle Plugins

How to use

Here is a little bit how you can use this plugin. For more details look at samples/build.gradle

apply plugin: 'com.github.zhurlik.jbossmodules'

repositories {
    mavenCentral()
}

configurations {
    hibernate43
    hibernate50
}

dependencies {
    ['aop', 'beans', 'core', 'context'].each {
        jbossmodules "org.springframework:spring-${it}:${springVersion}"
    }
    hibernate43 'org.hibernate:hibernate-core:4.3.11.Final'
    hibernate50 'org.hibernate:hibernate-core:5.0.6.Final'
}

jbossrepos {
    serverA {
        home = '/home/zhurlik/programs/jboss-as-7.1.1.Final'
        version = V_1_1
    }
}

modules {

    // springframework
    springCore {
        moduleName = 'org.springframework.core'
        resources = ["spring-core-${springVersion}.jar"]
        dependencies = ['javax.api',
                        'org.jboss.vfs',
                        'org.apache.commons.logging'
        ]
    }

    springBeans {
        moduleName = 'org.springframework.beans'
        resources = ["spring-beans-${springVersion}.jar"]
        dependencies = ['org.springframework.spring-core',
                        'javax.api',
                        'org.apache.commons.logging'
        ]
    }

    springAop {
        moduleName = 'org.springframework.aop'
        resources = ["spring-aop-${springVersion}.jar", 'aopalliance-1.0.jar']
        dependencies = ['org.springframework.spring-beans',
                        'org.springframework.spring-core',
                        'javax.api', 'org.apache.commons.logging'
        ]
    }
    // springframework
    
    // specify multiple versions of the same module
    hibernate43 {
        moduleName 'org.hibernate.core'
        resources = ["hibernate-core-4.3.11.Final.jar"]
        slot = '4.3.11'
        configuration = configurations.hibernate43
    }
      
    hibernate50 {
        moduleName 'org.hibernate.core'
        resources = ["hibernate-core-5.0.6.Final.jar"]
        slot = '5.0.6'
        configuration = configurations.hibernate50
    }

    moduleA {
        // to define on which servers this module will be available, by default - all
        servers = ['serverA']
        moduleName = 'com.github.zhurlik.a'
        mainClass = 'zh'
        slot = '3.3.3'
        properties = ['ver' : '1.0', 'test' : 'zhurlik']
        resources = ['test1.jar', "spring-core-${springVersion}.jar",
                     [name: 'name', path: 'path1', filter: [include:'**']]
        ]
        dependencies = [
                [name: 'module1'],
                [name: 'module2', export: 'true'],
                [name: 'module3', export: 'false', exports: [
                        include: ['mine'],
                        exclude: ['*not*a', '*not*b']
                    ]
                ]
        ]
    }

    moduleB {
        moduleName = 'com.github.zhurlik.b'
        mainClass = 'zh'
        slot = '3.3.3'
        properties = ['ver' : '1.0', 'test' : 'zhurlik']
        resources = ['test1.jar', 'test2.jar', 'custom.*',
                     [name: 'name', path: 'path1', filter: [exclude: '**']]
        ]
        dependencies = [
                [name: 'module1'],
                [name: 'module2', export: 'true'],
                [name: 'module3', export: 'false', imports: [
                        include: 'mine',
                        exclude: ['*not*a', '*not*b']
                    ]
                ]
        ]
    }
}

jbossrepos.each() {com.github.zhurlik.extension.JBossServer it->
    println '>> Server:' + it.home + ' modules:\n'

    it.initTree()
    it.names.each {
        println it
    }

    println it.getModule('org.jboss.jts.integration').moduleDescriptor
    assert it.getModule('org.jboss.jts.integration').isValid()
    println it.getMainXml('org.jboss.jts.integration')
}

gradle makeModules
gradle checkModules
gradle serverADistTar

Additional task InitModuleTask

Right now there is easy way to extract information from a pom file that can be used for generation JBoss Mdule

task initCamelModule(type: com.github.zhurlik.task.InitModuleTask) {
    pomName = 'camel-core-2.15.1'
}

About

This is a plugin for gradle allows to create modules to be able to use them under JBoss 7.x/8.x

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 100.0%