question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to give command line parameters during build

See original GitHub issue

Environment: Local

  • *Jib version: 2.1.0
  • Build tool: Gradle 5.4.1
  • OS: Windows

Description of the issue: I am having conditional based build to make normal spring boot jar with Netflix stack and application jar with Kubernetes stack.

Expected behavior: When I use the Gradle build with -Dk8s=true then the application jar will consist of Kubernetes stack. If the parameters not used while building then normal Netflix stack will be in the application jar

Steps to reproduce:

  1. Add the following command to build.gradle
if (System.getProperty("k8s") == "true") {
  dependencies {
    compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-kubernetes', version: '1.0.3.RELEASE'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-context', version: '2.1.1.RELEASE'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-kubernetes-config', version: '1.0.3.RELEASE'
  }
  configurations {
    compile.exclude group: "org.springframework.cloud", module: "spring-cloud-netflix-core"
  }
}
  1. Do the docker image build with ./gradlew jibDockerBuild -Dk8s=true
  2. Run the image in docker it should use the Kubernetes stack and not the Netflix stack

Log output:

Additional Information:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
tamizharasanrcommented, Apr 5, 2020

@loosebazooka Thanks for your guidance. The dive tool helped me a lot to figure out what went wrong. I missed JVM flag -Dspring.profiles.active=k8s for spring profile in the build.gradle file. Now it’s working fine as expected.

0reactions
loosebazookacommented, Apr 4, 2020

@tamizharasanr In order to test this, I need a completely working build.gradle. It appears the code snippet you provided us with is missing bom references and other versioning information. Please provide more info to help us proceed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Application is unable to get command argument - Stack Overflow
I'm unable to get command line argument with int main(int argc, char* argv[]) , No errors occurs but when further manipulation want to...
Read more >
Unable to add custom Unity command-line parameters #124
My build process utilizes command-line parameters that are different from the built-in parameters. For example, I use a custom parameter to pass in...
Read more >
Common Problems | TeamCity On-Premises Documentation
If the build succeeds from the console but still fails in TeamCity, use a command line runner in TeamCity to launch the same...
Read more >
Command-line parameter examples for Visual Studio installation
To illustrate how to use command-line parameters to install Visual Studio, here are several examples that you can customize to match your ...
Read more >
Can't use the CMake Integration for building from the ...
Hello, is there a way to build a CMake-based project with an appropriate CMakeSettings.json from the command line? I couldn't find any, e.g....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found