war plugin of gradle not copying files from src/main/java/** to classes folder - war

I am migrating build tool from Maven to Gradle for a web-application.
gradle build command is successful.
But, gradle is not copying .hbm.xml files from src\main\java\* folder to WEB-INF\classes\** folder.
build.gradle:
apply plugin: "war"
repositories {
mavenLocal()
mavenCentral()
}
ext {
hibernateVersion = "3.6.9.Final"
}
dependencies {
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "org.slf4j:slf4j-log4j12:$slf4jVersion"
compile "log4j:log4j:1.2.17"
compile "org.hibernate:hibernate-core:$hibernateVersion"
...
}

Related

Gamemaker 1.4 android build.gradle edit

I spent much time by making my android game and i have problem now.
I cant upload it to playstore because of 64 requipment. I have readed i could add this line to build.gradle
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
Could you help me please with adding this to gradle.build?
i have found that file in Roaming\GameMaker-Studio\Android\runner\RootFiles
This is content of the file.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0+'
}
}
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
im not sure if this is correct file, tried adding this line bud has error while compiling.
Or maybe you know diffrent way to do this.
I am using GMS 1.4
I've been checking different ways to make 1.4 to generate a 64-bit compatible apk file but even if you achieve to add arm-v8a and x86_64 so Gradle try to generate it, it still needs libyoyo.so (and maybe others) compatible files for each of your new abis to make a 64bits android compatible apk.
The only way to get those files is to have the source code and cross-compile it for each of the 64-bit required abis.

java.lang.NoClassDefFoundError with external library

I have created a custom jar file and tried to access the function in the java file from Flow in corda 3.3 version. I have added the jar file using Project Structure>Project Settings>Libraries>Java>. While running the code its not identifying the class path of added jar file and throwing java.lang.NoClassDefFoundError
Modified the build.gradle file and added flatDir {
dirs 'libs'
} where the jar file is residing

Gradle project dependency does not reference SNAPSHOT jar

I am trying to create a fat jar file in a multi-project Gradle build, something like the following:
root
+-- project1
+-- project2
project1 provides the basic functionality, which is then used by project2 to create an executable jar. The executable JAR needs to contain all of the code from the dependencies so that it can be run standalone.
For external dependencies this works fine. In project2 I create a new configuration:
apply plugin: 'maven'
apply plugin: 'java'
configurations {
// configuration for JARs that need to be included in the final packaging
includeInJar
}
and then add the dependencies:
dependencies {
includeInJar 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
...
configurations.compile.extendsFrom(configurations.includeInJar)
}
The packaging then looks like this:
jar {
manifest {
attributes "Main-Class": "com.acme.project1.MyTest"
}
// import all dependencies into the Jar so that it can be run easily
from {
configurations.includeInJar.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
The jar is correctly built with all of the files from the external dependencies. The problem comes with the project dependency to project1:
includeInJar project(':project1')
When this is present, I get an error when it tries to assemble the JAR that it can't find the jar (e.g. project1-0.4.0.jar) in the project1 build/libs directory as it does not exist. The message is correct, as project1 builds a SNAPSHOT jar (e.g. project1-0.4.0-SNAPSHOT.jar).
The question is, why does the configuration refer to the non-SNAPSHOT jar when the project is building SNAPSHOT jars? What can I change so that it finds the correct jar?
As a comment :
In my opinion, fatjar is not a great pattern. Maybe Gradle application plugin would fit your need ?
I found the answer to my own question.
The problem was that we have some additional scripting at the project level which is apparantly making a change to the version at the end of the configuration phase.
When the fat jar configuration is assembled, the 'plain' version is used. This is then changed to the -SNAPSHOT version before the jars are built.
Moving the from { ... } code into the build phase by wrapping it in doFirst { ... } is enough to fix the problem, although the real fix is obviously to avoid changing the version in the middle of the in the first place.

How to include a jar on disk as Gradle compile dependency

compile files('lib/ssi-jar-with-dependencies.jar')
Does not work. It does not break the script but does not include the dependency either.
The above declaration is correct (assuming you put it in the right place). Either the path is wrong, or there is some other problem with the build script (or the Jar).
You can add Flat directory repository:
repositories {
flatDir {
dirs 'lib'
}
flatDir {
dirs 'lib1', 'lib2'
} }

Where is the build path with Gradle

I want to use Gradle to build the snapshot version for file-uploader https://github.com/valums/file-uploader .
My grade version is 1.4 and when I run gradle zip on Mac OS X 10.7.5, it shows BUILD SUCCESSFUL, but I can not where can I find the result file ?
From the project's build.gradle file:
task zip(type: Zip) {
baseName "$filename-$version"
from files("$buildDir")
destinationDir file('release')
}
So the destination folder is called release, you'll find it under the project root.

Resources