Jaxb generating Java from multiple .xsd Files failed - xsd

i'm having this error and have no idea how it comes to this: it worked the last time I checked and I havenĀ“t made any single change
Build file 'D:\getVersionSoap\build.gradle' line: 134
Execution failed for task ':genJaxb'.
unable to parse the schema. Error messages should have been provided
Here is the piece of code:
"Line 134" is the line "xjc(destdir: sourcesDir)"
task genJaxb {
ext.sourcesDir = "${buildDir}/generated_sources/jaxb"
ext.classesDir = "${buildDir}/classes/jaxb"
ext.schemaDir = "${projectDir}/src/main/resources"
outputs.dir sourcesDir
doLast() {
project.ant {
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask",
classpath: configurations.jaxb.asPath
mkdir(dir: sourcesDir)
mkdir(dir: classesDir)
xjc(destdir: sourcesDir) {
schema(dir: schemaDir, includes: "**/ /* *.xsd")
arg(value: "-wsdl")
produces(dir: sourcesDir, includes: "**/ /* *.java")
}
javac(destdir: classesDir, source: 1.8, target: 1.8, debug: true,
debugLevel: "lines,vars,source",
classpath: configurations.jaxb.asPath,
includeantruntime: "false") {
src(path: sourcesDir)
include(name: "**/ /* *.java")
include(name: "*.java")
}
copy(todir: classesDir) {
fileset(dir: sourcesDir, erroronmissingdir: false) {
exclude(name: "**/ /* *.java")
}
}
}
}
}
Any idea? Thank you!

Related

Liquibase Hibernate missing SequenceStyleGenerator.generatorKey() error

I am trying to generate a diff changelog using Liquibase and Hibernate but when I run the command gradle diffChangeLog I get the following error:
ERROR [liquibase.integration.commandline.Main]: Unexpected error running Liquibase: 'java.lang.Object org.hibernate.id.enhanced.SequenceStyleGenerator.generatorKey()'
java.lang.NoSuchMethodError: 'java.lang.Object org.hibernate.id.enhanced.SequenceStyleGenerator.generatorKey()'
I am able to generate a changelog, but only get issues when trying to generate a diff changelog. My build.gradle.kts file is below:
plugins {
java
id("org.springframework.boot") version "2.6.2"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("org.liquibase.gradle") version "2.1.1"
}
group = "com.example"
version = "0.0.1-SNAPSHOT"
var sourceCompatibility = "11"
val postgresVersion = "42.2.19"
val liquibaseVersion = "2.1.1"
val lombokVersion = "1.18.20"
val liquibaseCoreVersion = "3.8.4"
val liquibaseExtVersion = "5:3.8"
val hibernateCoreVersion= "5.4.10.Final"
repositories {
mavenCentral()
maven {
url = uri("https://repo.spring.io/milestone")
}
maven {
url = uri("https://repo.spring.io/snapshot")
}
}
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("net.ltgt.gradle:gradle-apt-plugin:0.18")
classpath("org.postgresql:postgresql:42.2.9")
classpath("org.liquibase.ext:liquibase-hibernate5:3.8")
classpath("org.liquibase:liquibase-core:3.8.4")
classpath("org.liquibase:liquibase-gradle-plugin:2.0.2")
classpath("org.springframework.data:spring-data-jpa:2.2.1.RELEASE")
}
}
dependencies {
implementation("org.jetbrains:annotations:20.1.0")
runtimeOnly("org.postgresql:postgresql")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
// implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.postgresql:postgresql:$postgresVersion")
implementation("org.springframework.boot:spring-boot-starter")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group= "junit", module= "junit")
}
//testImplementation("org.springframework.security:spring-security-test")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.hamcrest:hamcrest-library:2.2")
implementation("org.liquibase:liquibase-core:$liquibaseCoreVersion")
implementation("org.liquibase.ext:liquibase-hibernate$liquibaseExtVersion")
implementation("org.springframework.boot:spring-boot:2.6.2")
implementation("info.picocli:picocli:4.6.1")
implementation("org.liquibase:liquibase-groovy-dsl:3.0.0")
liquibaseRuntime("org.liquibase:liquibase-core:$liquibaseCoreVersion")
liquibaseRuntime("org.liquibase:liquibase-groovy-dsl:2.1.1")
liquibaseRuntime("org.postgresql:postgresql:$postgresVersion")
liquibaseRuntime("org.liquibase.ext:liquibase-hibernate$liquibaseExtVersion")
liquibaseRuntime(sourceSets.getByName("main").compileClasspath)
liquibaseRuntime(sourceSets.getByName("main").runtimeClasspath)
liquibaseRuntime(sourceSets.getByName("main").output)
compileOnly("org.projectlombok:lombok:$lombokVersion")
annotationProcessor("org.projectlombok:lombok:$lombokVersion")
}
tasks.named<Test>("test") {
useJUnitPlatform()
}
tasks {
// Use the native JUnit support of Gradle.
"test"(Test::class) {
useJUnitPlatform()
}
}
liquibase {
activities.register("main") {
this.arguments = mapOf(
"classpath" to "src/main/resources",
"driver" to "org.postgresql.Driver",
"logLevel" to "info",
"changeLogFile" to "src/main/resources/db/changelog/changes/changelog_002.xml",
"url" to "jdbc:postgresql://localhost:54320/postgres?currentSchema=schema",
"username" to "postgres",
"password" to "postgres",
"referenceUrl" to "hibernate:spring:com.example?dialect=org.hibernate.dialect.PostgreSQLDialect" +
"&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate." +
"SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=" +
"org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy")
}
}
I have tried to change the versioning around but then get an error saying the driver could not be found.
Any help would be greatly appreciated! Thank you

grunt cssmin different target files for style.min.css and above-the-fold.min.css

In an older version of cssmin it was possible to create to different target files. I minified a style.min.css and an above-the-fold.min.css. Now I updated to a newer version of nodejs, npm, grunt and cssmin and it is not possible to minify to different outputfiles anymore. Since the update grunt only minifies the second task and skip the first task. Do you have a hint for me to minify both tasks?
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: {
'data/style.min.css': ['a.css', 'b.css', 'c.css', 'd.css', 'e.css', 'f.css', 'g.css']
}
}
},
penthouse: {
extract : {
outfile : 'data/above-the-fold.temp.css',
css : './data/style.min.css',
url : 'http://localhost/',
width : 1280,
height : 500
},
},
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: {
'data/above-the-fold.min.css': ['data/above-the-fold.temp.css']
}
}
}
grunt-contrib-cssmin will allow multiple Targets to be defined in a single Task. For example:
Gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
// ...
cssmin: { // <-- cssmin Task
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
targetA: { // <-- First target
files: {
'data/style.min.css': ['a.css', 'b.css', 'c.css', 'd.css', 'e.css', 'f.css', 'g.css']
}
},
targetB: { // <-- Second target
files: {
'data/above-the-fold.min.css': ['data/above-the-fold.temp.css']
}
}
}
// ...
});
// ...
};
Each Target name should be unique within the cssmin Task. For example: targetA and targetB
As you've included the penthouse Task in your post, I guess that you need to run that after generating the style.min.css file, and before generating the above-the-fold.min.css. To do this you can register your Tasks as follows:
grunt.registerTask('default', ['cssmin:targetA', 'penthouse', 'cssmin:targetB',]);
Note: The use of the semi-colon notation, namely cssmin:targetA and cssmin:targetB. This simply ensures that targetA of the cssmin Task is run before the penthouse Task. Subsequently, (when the penthouse Task completes), targetB of the cssmin Task is run.

How to use if else condition in Gradle

Can someone tell me how could I write the if else condition in the gradle script
I mean i have two different types of zip files one is LiceseGenerator-4.0.0.58 and other one is CLI-4.0.0.60.My deployment script is working fine but I am using the shell script to do this and I want everything in gradle instead of doing it in the shell script.I want when I am deploying the LicenseGenerator it should deploy in differnet way and if it is CLI then it should deploy in other way.Currently deployall task is doing everyting.If I put if else condition how could I call the task.Please let me know if need any other information
Below is my script
// ------ Tell the script to get dependencies from artifactory ------
buildscript {
repositories {
maven {
url "http://ct.ts.th.com:8/artifactory/libs-snapshot"
}
}
// ------ Tell the script to get dependencies from artifactory ------
dependencies {
classpath ([ "com.trn.cm:cmplugin:1.1.118" ])
}
}
apply plugin: 'com.trn.cm.cmgplugin'
/**
* The folloing -D parameters are required to run this task
* - deployLayer = one of acceptance, latest, production, test
*/
//------------------------------------------------------------------------------------------
// Read the properties file and take the value as per the enviornment.
//
//------------------------------------------------------------------------------------------
if(!System.properties.deployLayer) throw new Exception ("deployLayer must be set")
def thePropFile = file("config/${System.properties.deployLayer}.properties")
if(!thePropFile.exists()) throw new Exception("Cannot load the specified environment properties from ${thePropFile}")
println "Deploying ${System.properties.jobName}.${System.properties.buildNumber} to ${System.properties.deployLayer}"
// load the deploy properties from the file
def deployProperties = new Properties()
thePropFile.withInputStream {
stream -> deployProperties.load(stream)
}
// set them in the build environment
project.ext {
deployProps = deployProperties
deployRoot = deployProperties["${System.properties.jobName}.deployroot"]
deployFolder = deployProperties["${System.properties.jobName}.foldername"]
deployPostInstallSteps = deployProperties["${System.properties.jobName}.postInstallSteps"]
}
task deleteGraphicsAssets(type: Delete, dependsOn: deploy) {
def dirName = "${deployRoot}"
delete dirName
doLast {
file(dirName).mkdirs()
}
}
task myCustomTask(dependsOn: deleteGraphicsAssets) << {
copy {
from 'deploymentfiles'
into "${deployRoot}"
}
}
task cleanTempDir(type: Delete, dependsOn: myCustomTask) {
delete fileTree(dir: "build/artifacts", exclude: "*.zip")
}
task unzipArtifact(dependsOn: cleanTempDir) << {
file("${buildDir}/artifacts").eachFile() {
println "Deploying ${it}"
// ant.mkdir(dir: "${deployRoot}/${deployFolder}")
ant.unzip(src: it, dest: "${deployRoot}")
}
}
task setPerms( type: Exec, dependsOn: unzipArtifact) {
workingDir "${deployRoot}"
executable "bash"
args "-c", "dos2unix analyticsEngine.sh"
args "-c", "chmod u+x analyticsEngine.sh && ./analyticsEngine.sh"
}
task deployAll(dependsOn: setPerms){}
I used in below way it is working fine
// ------ Tell the script to get dependencies from artifactory ------
buildscript {
repositories {
maven {
url "http://c.t.th.com:8/artifactory/libs-snapshot"
}
}
// ------ Tell the script to get dependencies from artifactory ------
dependencies {
classpath ([ "c.t.c:cmgin:1.1.118" ])
}
}
apply plugin: 'com.t.c.cmlugin'
/**
* The folloing -D parameters are required to run this task
* - deployLayer = one of acceptance, latest, production, test
*/
//------------------------------------------------------------------------------------------
// Read the properties file and take the value as per the enviornment.
//
//------------------------------------------------------------------------------------------
if(!System.properties.deployLayer) throw new Exception ("deployLayer must be set")
def thePropFile = file("config/${System.properties.deployLayer}.properties")
if(!thePropFile.exists()) throw new Exception("Cannot load the specified environment properties from ${thePropFile}")
println "Deploying ${System.properties.jobName}.${System.properties.buildNumber} to ${System.properties.deployLayer}"
// load the deploy properties from the file
def deployProperties = new Properties()
thePropFile.withInputStream {
stream -> deployProperties.load(stream)
}
// set them in the build environment
project.ext {
deployProps = deployProperties
deployRoot = deployProperties["${System.properties.jobName}.deployroot"]
deploydir = deployProperties["${System.properties.jobName}.deploydir"]
deployFolder = deployProperties["${System.properties.jobName}.foldername"]
deployPostInstallSteps = deployProperties["${System.properties.jobName}.postInstallSteps"]
}
task deleteGraphicsAssets(type: Delete, dependsOn: deploy) {
def dirName = "${deployRoot}"
delete dirName
doLast {
file(dirName).mkdirs()
}
}
task copyartifactZip << {
copy {
from "${deployRoot}"
into "${deploydir}/"
}
}
task copyLicenseZip << {
copy {
from "${deployRoot}"
into "${deploydir}/${deployFolder}"
}
}
task myCustomTask(dependsOn: deleteGraphicsAssets) << {
copy {
from 'deploymentfiles'
into "${deployRoot}"
}
}
task unzipArtifact(dependsOn: myCustomTask) << {
def theZip = file("${buildDir}/artifacts").listFiles().find { it.name.endsWith('.zip') }
println "Unzipping ${theZip} the artifact to: ${deployRoot}"
ant.unzip(src: theZip, dest: "${deployRoot}", overwrite: true)
}
task setPerms(type:Exec, dependsOn: unzipArtifact) {
workingDir "${deployRoot}"
executable "bash"
args "-c", "chmod -fR 755 *"
}
def dirName = "${deploydir}/${deployFolder}"
task zipDeployment(type: GradleBuild, dependsOn: setPerms) { GradleBuild gBuild ->
def env = System.getenv()
def jobName=env['jobName']
if (jobName.equals("LicenseGenerator")) {
delete dirName
file(dirName).mkdirs()
gBuild.tasks = ['copyLicenseZip']
} else {
gBuild.tasks = ['copyartifactZip']
}
}
task deployAll(dependsOn: zipDeployment){}
It's usually a bad practice to have if/else logic in the build script because it adds complexity and sometimes causes surprising and unexpected results. Since you have very different artifacts, it's advisable to have two different tasks for that, instead of one-for-all deployAll. And you should call corresponding task when you are in different environments.

Griffon: Error when execute code for JInternalFrame

I just searching in google recently and want to try this code below to work in Griffon 1.2.0 but when i run it it give me error like this:
2013-03-23 12:13:01,877 [main] DEBUG griffon.plugins.i18n.I18nEnhancer - Enhancing org.codehaus.groovy.runtime.HandleMetaClass#b7ea5c[groovy.lang.ExpandoMetaClass#b7ea5c[class griffon.swing.SwingApplication]] with griffon.plugins.i18n.MessageSourceHolder#7b7bee
2013-03-23 12:13:01,909 [main] ERROR griffon.util.GriffonExceptionHandler - Uncaught Exception
groovy.lang.GroovyRuntimeException: Cannot add new method [getMessage] for arguments [[class java.lang.String, class java.util.Locale]]. It already exists!
at griffon.plugins.i18n.I18nEnhancer.enhance(I18nEnhancer.groovy:34)
at griffon.plugins.i18n.I18nEnhancer.enhance(I18nEnhancer.groovy)
at griffon.plugins.i18n.I18nEnhancer$enhance.call(Unknown Source)
at I18nSupportGriffonAddon.addonPostInit(I18nSupportGriffonAddon.groovy:40)
at griffon.core.GriffonAddon$addonPostInit.call(Unknown Source)
at griffon.core.GriffonAddon$addonPostInit.call(Unknown Source)
at org.codehaus.griffon.runtime.util.AddonHelper$_handleAddonsAtStartup_closure3.doCall(AddonHelper.groovy:110)
at org.codehaus.griffon.runtime.util.AddonHelper.handleAddonsAtStartup(AddonHelper.groovy:108)
at org.codehaus.griffon.runtime.core.DefaultAddonManager.doInitialize(DefaultAddonManager.java:33)
at org.codehaus.griffon.runtime.core.AbstractAddonManager.initialize(AbstractAddonManager.java:101)
at org.codehaus.griffon.runtime.util.GriffonApplicationHelper.initializeAddonManager(GriffonApplicationHelper.java:394)
at org.codehaus.griffon.runtime.util.GriffonApplicationHelper.prepare(GriffonApplicationHelper.java:149)
at org.codehaus.griffon.runtime.core.AbstractGriffonApplication.initialize(AbstractGriffonApplication.java:231)
at griffon.swing.AbstractSwingGriffonApplication.bootstrap(AbstractSwingGriffonApplication.java:75)
at griffon.swing.AbstractSwingGriffonApplication.run(AbstractSwingGriffonApplication.java:132)
at griffon.swing.SwingApplication.run(SwingApplication.java:45)
at griffon.swing.SwingApplication.main(SwingApplication.java:37)
[delete] Deleting directory G:\latihan\outer\staging\windows
Here's the code, this was originaly made by aalmiray
--- OuterController ---
package outer
class OuterController {
def model
def view
def builder
def newFrame = {
String id = 'inner-' + System.currentTimeMillis()
def (m, v, c) = createMVCGroup('inner', id, title: "Frame ${model.count++}")
builder.desktopPane(view.desktop) {
widget(v.innerFrame)
}
}
}
--- OuterModel ---
package outer
class OuterModel {
int count = 1
}
--- OuterView ---
package outer
application(title: 'outer',
preferredSize: [320, 240],
pack: true,
locationByPlatform:true,
iconImage: imageIcon('/griffon-icon-48x48.png').image,
iconImages: [imageIcon('/griffon-icon-48x48.png').image,
imageIcon('/griffon-icon-32x32.png').image,
imageIcon('/griffon-icon-16x16.png').image]) {
borderLayout()
button(newFrameAction, constraints: NORTH)
desktopPane(id: 'desktop', constraints: CENTER)
}
--- InnerController ---
package outer
class InnerController {
private String id
def view
void mvcGroupInit(Map args) {
id = args.mvcName
}
void mvcGroupDestroy() {
execAsync {
def desktop = view.innerFrame.parent
desktop.remove view.innerFrame
desktop.invalidate()
desktop.repaint()
}
}
def close = {
destroyMVCGroup id
}
}
--- InnerView ---
package outer
internalFrame(title: title, size: [200, 200], id: 'innerFrame',
visible: true, iconifiable: true, maximizable: true,
resizable: true, closable: true) {
gridLayout(cols: 1, rows: 2)
label 'Content goes here'
button closeAction
}
I need your help.
Regards,
Hendra
Gievn the error message I'd say you have the i18n and i18n-support plugins installed. These plugins are no longer required since Griffon 1.1.0. Uninstalling the plugins will solve your problem.
The reason is that the functionality provided by those plugins is now available in Griffon core since 1.1.0, so those plugins create a conflict.

How to run jetty 7+ with specified war with groovy/gradle?

I want to run Jetty 7+ with gradle build, but unlucky looks like there is no way to do this with jettyRun. So probably simplest idea to achieve what I want would be to use custom target:
task runJetty << {
def server = new Server()
// more code here
server.start()
server.join()
}
Unlucky I just started with gradle and I don't know groovy either, so it's hard for me to create proper target. I was looking over the internet but I wasn't able to find any solution.
Can anyone hit me with some sample groovy code which can run existing jar with jetty?
Ok, I found out how to run it using jetty directly from repository:
jettyVersion = "8.1.0.RC0"
configurations {
jetty8
}
dependencies {
jetty8 "org.mortbay.jetty:jetty-runner:$jettyVersion"
}
task runJetty8(type: JavaExec) {
main = "org.mortbay.jetty.runner.Runner"
args = [war.archivePath]
classpath configurations.jetty8
}
Here's a working version, using the jetty ant tasks. This finally enabled me the proper control with deamon=true.
configurations { jetty }
dependencies { jetty 'org.eclipse.jetty:jetty-ant:9.0.4.v20130625' }
task jetty(dependsOn: build) << {
ant.taskdef(name: 'jettyRun', classname: 'org.eclipse.jetty.ant.JettyRunTask', classpath: configurations.jetty.asPath, loaderref: "jetty.loader")
ant.typedef(name: "connector", classname: "org.eclipse.jetty.ant.types.Connector", classpath: configurations.jetty.asPath, loaderref: "jetty.loader")
ant.jettyRun(daemon:true, stopPort: 8999, stopKey: "STOP") {
webApp(war: THE_WAR_PRODUCING_TASK.archivePath, contextPath: '/context')
connectors { connector(port: 9000) }
systemProperties {
systemProperty(name: 'environment.type', value: 'development')
}
}
}
task jettyStop << {
ant.taskdef(name: 'jettyStop', classname: 'org.eclipse.jetty.ant.JettyStopTask', classpath: configurations.jetty.asPath)
ant.jettyStop(stopPort: 8999, stopKey: "STOP")
}
There is a jetty-eclipse-plugin that allows you to run newer versions of jetty
https://github.com/Khoulaiz/gradle-jetty-eclipse-plugin
jetty plugin supports jetty 6.1.25 at present
You can use something like this:
jettyRoot = '/path/to/your/jetty/root'
task runJetty7 << {
description = "Runs jetty 7"
ant.java(dir: jettyRoot, jar: jettyRoot + '/start.jar', failOnError: 'true', fork: 'true') {
classpath {
...
}
}
}

Resources