w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » GRADLE » Page 1
Gradle plugin compatibility - how to find out?
It depends on the particular plugin, and would ideally be tested/documented there. 1.x to 2.x was a big jump in terms of the Groovy version used by Gradle, which can cause compatibility issues for plugins implemented in Groovy. Also, 1.x plugins using deprecated or internal APIs may not work in 2.x.

Categories : Gradle

How to speed up the tomcat starting process in gradle?
You can run this task in background but it will be maybe not difficult but problematic to keep control of the running process (e.g. stopping it on demand - which might be solved by adding stopTomcat task). What You need is the following piece of code: task startTomcat << { def processBuilder = new ProcessBuilder(['cmd','/c','startup.bat']) processBuilder.directory(new File("$tomcat_ho

Categories : Gradle

upload an eclipse android library project to maven central
It looks like you don't have permissions to publish artifacts for the com.github.amanasatija group ID on the server. File an issue for this at https://issues.sonatype.org under the "Community Support - Open Source Project Repository Hosting" project and we'll help you get this sorted out.

Categories : Gradle

Allure gradle integration
Allure TestNG Gradle example here https://github.com/allure-examples/allure-gradle-testng-example It's works because TestNG supports Java SPI for adding test listeners. But JUnit does't have such feature. You can check out the following PR to JUnit https://github.com/junit-team/junit/pull/923 If you need Gradle support for JUnit right now you can try to implement Gradle Test Listener (http://www

Categories : Gradle

How to make a runnable jar with gradle that depends on three jars?
The easiest way is to merge the dependency Jars into the main Jar: jar { from "path/to/jar1", "path/to/jar2" } Or, if the Jars are retrieved from a Maven/Ivy repository: jar { from configurations.runtime } Alternatively, you can use a plugin such as gradle-onejar, which covers more use cases.

Categories : Gradle

Is it possible to get properties of properties by command-line in Gradle
There isn't currently a built-in feature for discovering nested properties from the command line. Better discoverability of the build language/model is a planned feature on the way to 3.0. Until then, the Gradle Build Language Reference is the best source of information to answer such questions.

Categories : Gradle

Sonar does not pick up test coverage information
Use gradle test sonarRunner to make sure that test and coverage results are up-to-date. Avoid absolute paths in build scripts. Groovy only performs String interpolation for double-quoted strings ("$buildDir/test-results"). If you have the jacoco and java plugins applied, all the Sonar properties shown in your snippet should be preconfigured correctly.

Categories : Gradle

Gradle Increment VersionCode for Release Build
Everything a task should do when it gets executed needs to go into a task action. A task action is added with doLast { /* code goes here */ }. Code outside a task action configures the task, and gets run on every build invocation as part of "parsing" the build script.

Categories : Gradle

Copy task in Gradle says "UP TO DATE" on first attempt
The code is reading the timestamp at configuration time, before any task has run. (You can see this by adding a println statement.) Because no timestamp file exists at this time (in particular on the first run), no source location (from ...) gets configured, and the task is considered up-to-date because there is nothing to copy. Putting the whole timestamp logic into the into block (into { ...; ap

Categories : Gradle

How to easily build projects from a specific subdirectory in parallel with Gradle?
After adding include "examples" in settings.gradle, you'll be able to run gradlew assembleDebug from the examples directory. If you want more than that, you can additionally add the following to examples/build.gradle: task examples { dependsOn { subprojects.assembleDebug } }

Categories : Gradle

IntelliJ IDEA 14 gradle loading dependencies with classifier OR without classifier; not AND
This is know issue, IntelliJ version 14.0.1 will contain the fix for this. Ticket: https://youtrack.jetbrains.com/issue/IDEA-127178

Categories : Gradle

Error excluding transitive dependencies in Gradle build file
Normally, I'd exclude transitive dependencies by specifying dependencies { myConfiguration('group:module:version') { transitive = false } } For more fine grained control over versions etc, have a look at ResolutionStrategy

Categories : Gradle

unable to execute jar file(consists dependencies), which is build from gradle
You'll want to specify dependency jar(s) as a part of classpath, when you are executing your jar. Something along these these lines: java -cp myJar.jar:./lib/BuildBasicJavaProject.jar my.package.MyMainClass Bare in mind that classpath delimiters are different on different platforms (: is for *nix based systems).

Categories : Gradle

Purpose of << in gradle
If you have << it will execute the print lines when the task is executed and not having it executes the print lines when the task is configured. This can effect your output since the Gradle Lifecycle is Initialization > Configuration > Execution. For example if your build.gradle contains: task "task0" << { println "task 0" } task "task1" { println "task 1" } Then if you e

Categories : Gradle

Run Jmeter in non GUI Mode from Gralde Jmeter Plugin
You can configure save results file in user properties, then include the properties file in gradle config using jmeterUserPropertiesFiles To start jmeter in non-gui via gradle, you use: gradle jmeterRun

Categories : Gradle

android studio Error:(20, 0) Build script error, unsupported Gradle DSL method found: 'android()'!
This means that the build.gradle for which the error occurs is missing a line such as apply plugin: 'com.android.application' at the top. (Details depend on which version of the Android Gradle plugin your build is using.)

Categories : Gradle

upload both project jar & exernal jar to local maven repository
I'm not sure at all but i can try to gues what just happen. task uploadArchives {...} according to gradle specification is type : (type: Upload) So lets go to upload specification, and what we got here: Properties: artifacts configuration repositories uploadDescriptor and i guess that you have: configurations { externalJar } above the uploadArchives as global configuration, so uplo

Categories : Gradle

Gradle build not invoking JUnit
Apparently, EARProject doesn't have any tests. Depending on what you want, run gradle build from the top directory, or from a subproject/subdirectory containing tests. Alternatively, you can run gradle buildNeeded from EARProject, which will perform a full build of all projects that EARProject depends upon (which presumably includes JARProject and WebProject).

Categories : Gradle

How to add gradle generated source folder to Eclipse project?
You can easily add the generated folder manually to the classpath by eclipse { classpath { file.whenMerged { cp -> cp.entries.add( new org.gradle.plugins.ide.eclipse.model.SourceFolder('gen/main/java', null) ) } } } whereby null as a second constructor arg means that Eclipse should put the compiled "class" files within the default output folder. If you wa

Categories : Gradle

Gradle maven-publish for Spring-Boot project throws error: Cannot find parent: org.springframework.boot:spring-boot-starter-parent for project
Ok, I have fixed the issue. I am behind our corporate firewall, and had configured proxy correctly for gradle in ~/.gradle/gradle.properties file. But, I missed setting proxies for maven in ~/.m2/settings.xml file. I configured our internal nexus repository to handle this issue but setting proxies block should work as well. Click here for maven settings.xml documentation

Categories : Gradle

Cache gradle dependencies, Travis CI
You'll have to cache at least ~/.gradle/wrapper and ~/.gradle/caches, but I'd probably start out with ~/.gradle. (If necessary, the location of the latter can be changed by setting the GRADLE_USER_HOME environment variable). When upgrading to a newer Gradle version, the cache structure may change, so it might make sense to invalidate the cache from time to time. PS: Please don't double-post here

Categories : Gradle

How to use flyway with gradle? First migration depends on gradle build
flywayinit is for adding flyway to an existing production database that already has tables with data in it. In that scenario you create a V1 migration that would set up all the existing production tables. This allows you to set up a new DB from scratch using flyway. However you obviously don't want to run the V1 migration against production, because those tables already exist and have production

Categories : Gradle

Can spring roo deal with gradle projects?
As far I Know, there is no plan to support gradle. At least on 1.X and 2.x branch. You can vote the Jira improvement about it.

Categories : Gradle

Find all sub configurations for a configuration
The Configuration#getExtendsFrom returns the set of superconfigurations for the given configuration. You can print the list of superconfigurations of a given configuration as task printConfig { configurations.testRuntime.extendsFrom.each { println it.name } } This however does not list the superconfigurations of the superconfiguration (i.e., recursive list). But a little code around this w

Categories : Gradle

Gradle Manifest.MF
In the end I've managed to get what I wanted using the following code:- jar.doFirst { manifest { def manifestFile = "${projectDir}/META-INF/MANIFEST.MF" if ( new File( manifestFile ).exists() ) from ( manifestFile ) def requiredProjects = '' configurations.compile.getAllDependencies().withType(ProjectDependency).each {dep-> def depend

Categories : Gradle

spring-boot-jersey does not autodiscover jersey-media-moxy
You're trying to use version 2.13 of jersey-media-moxy with Boot 1.2.0.M2. Boot 1.2.0.M2 uses version 2.7 of the other Jersey modules. Dropping back to 2.7 of the jersey-media-moxy module should fix the problem. Alternatively, Boot's latest 1.2.0 snapshots are now using Jersey 2.13 so you could update your Boot dependency to 1.2.0.BUILD-SNAPSHOT instead.

Categories : Gradle

Spring boot Jersey with groovy/gradle fails on startup
You've found a bug in Spring Boot. Thanks for the help in tracking it down. As mentioned in the bug report you can work around the problem by excluding the auto-configuration for Groovy templates: @ComponentScan @EnableAutoConfiguration(exclude=GroovyTemplateAutoConfiguration.class) class ApiApplication extends SpringBootServletInitializer { // … }

Categories : Gradle

How to find unused Gradle repositories
There is no built-in way to see which of the declared repositories are (not) being used. Perhaps you could get this information by running with --refresh-dependencies and scraping the --info logs. Otherwise it will likely be a manual trial-and-error operation (comment repositories in/out until you've found a minimal set).

Categories : Gradle

gradle adding -source.jar to war
I think the reason is that the source artifact is published in the runtime configuration as well, if you use a special configuration (e.g. sources) it should work: publications { ivyJava(IvyPublication) { from components.java configurations.create('sources') artifact(sourceJar) { conf "sources" } } } (configurations.create() is needed because of GRADLE-3162)

Categories : Gradle

Can gradle use latest.release as default dependency version?
Generally, best practice is to always build against the exact version in order to avoid unpredicted scenarios. However, if you really want to build against latest release, you can do it like this: dependencies { myConfiguration 'group:module:latest.release' } The only (proper) way to enforce latest.release for all the artefacts is to write a resolution strategy. Have a look at: ResolutionStr

Categories : Gradle

Add properties to project in Gradle plugin
Here's how extra properties should be set: class MyPlugin implements Plugin<Project> { @Override void apply(Project project) { project.ext.my_property = 123 println(project.my_property) } } And here You can find the whole section on how properties work with gradle.

Categories : Gradle

What are the current downsides of gradle?
I am currently using Gradle as part of Android Studio, and its working decently. For me I had a HUGE headache getting started because the default settings of Gradle requires internet connection for the initial build (I assume it was for updates) and it fails to build if it can't make communication with the internet the first time. (so there are some Firewall issue you might need to work around) So

Categories : Gradle

Gradle task behaves differently with Type modifier
It was working before only incidentally. In the first task you are performing the copy during the configuration phase, since the call to copy() is done in a configuration closure. In the second task, the copy operation will only be done when the task is executed. Try manually executing the task with gradle releaseJarsTask2.

Categories : Gradle

How to share variable between Gradle buildSrc and rest of project?
There is no built-in way to share information between the buildSrc build and the main build. However, you could read your own properties file from both (using java.lang.Properties).

Categories : Gradle

Gradle jetty plugins how to run it on a specific ip address and port number
What You need is: //other plugins apply plugin: 'jetty' httpPort = 9000 jettyRun { reload = "automatic" scanIntervalSeconds = 10 } As far as I know host isn't configurable - You just run it and it depends on os specific configuration if it's accessible from other hosts or not.

Categories : Gradle

Configuration for projects in subdirectory
Adding this to build.gradle does what I wanted to achieve: // Define what's a plugin and what's a shared library by directory paths. // Ignore empty projects def plugins = subprojects.findAll{ it.path.contains("plugins") && hasSrc(it) } def sharedLibs = subprojects.findAll{ it.path.contains("shared") && hasSrc(it)} /** Checks whether a project has a source directory */ def hasSrc

Categories : Gradle

spring-boot gradle plugin can't be found
Applying a plugin by plugin id is not supported in script plugins. You must use the plugin's fully qualified class name. apply plugin: org.springframework.boot.gradle.SpringBootPlugin See this thread for more information.

Categories : Gradle

Gradle's publishToMavenLocal task is not executed correctly
I think this could be a manifestation of a bug with gradle, that modules can lose the publishMavenJavaPublicationToMavenLocal task when they are depended upon in a certain way. If gradle determines that there is no publishMavenJavaPublicationToMavenLocal task for a module then the publishToMavenLocal task will always report that it is up to date. The specific case I have found occurs in a multim

Categories : Gradle

Getting settings object from the buildscript
There isn't a way to get to the settings object from a build script. However, both scripts share a gradle object, which you could use to set an extra property in the settings script (e.g. gradle.ext.foo = "bar"), and read it in the build script (e.g. println gradle.foo).

Categories : Gradle




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.