PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 19, 2022

[FIXED] How can I add command to Gradle to be executed during build?

 November 19, 2022     build.gradle, gradle, scripting, spring-boot     No comments   

Issue

project is Gradle based

I have this command

apollo schema:download --endpoint=https://*******************************/graphql schema.json

this downloads json file from that endpoint then I put that file under the schema(name) package, manually, this is what I tried I worked this command and put it under the package is there any way to do this with scripts so this is automatically done?

I tried this

task<Exec>("apollo") {
commandLine("exec", "apollo schema:download --endpoint=https://*************************/graphql schema.json")

}

I want to do ./gradlew build and during build also run this apollo command


Solution

You can make your build task depend on another task like this:

task downloadStuff {
    logger.error('Downloading dependency.')
    logger.error('Moving dependency somewhere or whatever.')
}

build {
    dependsOn downloadStuff
}

Make sure to add it to the root project build.gradle file if you have multiple and it should also be top level.



Answered By - void void
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing