How to set project.version by passing version property on gradle command line?

How to set project.version by passing version property on gradle command line?

You can set the project.version property in a Gradle project by passing it as a command-line argument when running Gradle tasks. You can use the -P or --project-prop option to set the property. Here's how you can do it:

  1. Open a terminal or command prompt.

  2. Navigate to the root directory of your Gradle project.

  3. Run the Gradle task along with the -P option to set the project.version property. For example, to set the version to "1.2.3," you can use the following command:

    ./gradlew clean build -Pproject.version=1.2.3
    

    Or, on Windows:

    gradlew.bat clean build -Pproject.version=1.2.3
    
  4. Gradle will execute the specified tasks with the project.version property set to the value you provided on the command line.

You can use this approach to set project properties from the command line for various purposes, such as specifying a version, customizing build behavior, or configuring your project dynamically based on different environments or requirements.


More Tags

python entity-framework-core icmp jasmine depth-first-search ngx-translate react-16 classloader propagation benchmarking

More Java Questions

More General chemistry Calculators

More Weather Calculators

More Investment Calculators

More Cat Calculators