{"id":8494,"date":"2024-05-25T12:01:49","date_gmt":"2024-05-25T12:01:49","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=8494"},"modified":"2024-05-25T12:01:52","modified_gmt":"2024-05-25T12:01:52","slug":"auto-accept-gradle-tos-for-build-scan-run-without-scan","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/auto-accept-gradle-tos-for-build-scan-run-without-scan\/","title":{"rendered":"Auto-Accept Gradle ToS for build &#8211;scan &amp; Run Without Scan"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 3,508<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p>To accept the Gradle Terms of Service (ToS) for <code>build --scan<\/code> automatically and still manage to run the build without a scan, you can configure your Gradle build script and use command line options accordingly. Here are the steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Accept the Terms of Service Automatically<\/strong>:<br>You need to accept the Gradle Terms of Service programmatically. This can be done by adding the following configuration to your <code>gradle.properties<\/code> file or by setting an environment variable. <br><br><strong>Option 1: Using <code>gradle.properties<\/code> file<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-424bc5b4c5cbb407c4c4c4852c253c6d\"><code>   <code>systemProp.gradle.enterprise.build-scan.accept-tos=true<\/code><\/code><\/pre>\n\n\n\n<p><strong>Option 2: Using environment variable<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-89e08cf7851b26ed96bc7852ead191d4\"><code>   <code>export GRADLE_OPTS=\"-Dgradle.enterprise.build-scan.accept-tos=true\"<\/code><\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li><strong>Running the Build Without a Scan<\/strong>:<br>To ensure that the build runs without creating a build scan, simply avoid using the <code>--scan<\/code> option in your build command. You can run your build with the usual Gradle command:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-f3063f5d5141b3488fd52de17d7e3bf5\"><code>   <code>.\/gradlew build<\/code><\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li><strong>Optional: Enabling\/Disabling Scan in Different Environments<\/strong>:<br>If you want more control over when to enable or disable the scan, you can set up conditional logic in your <code>build.gradle<\/code> file. For example, you can enable scans only in certain environments or based on a project property. <br><strong>Example<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-96dad5a1f765d6b03d4a997956975f35\"><code>  <code> if (project.hasProperty('enableScan') &amp;&amp; project.enableScan == 'true') {\n       buildScan {\n           termsOfServiceUrl = 'https:\/\/gradle.com\/terms-of-service'\n           termsOfServiceAgree = 'yes'\n       }\n   }<\/code><\/code><\/pre>\n\n\n\n<p>To run the build with a scan enabled, you can use:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-97dc96989411bc55e737fb5e69d43bb7\"><code> <code>  .\/gradlew build --scan -PenableScan=true<\/code><\/code><\/pre>\n\n\n\n<p>To run the build without a scan, simply omit the <code>-PenableScan=true<\/code> property:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-dfa80b614f2d1f7b6dd97daa05cd9e4e\"><code> <code>  .\/gradlew build<\/code><\/code><\/pre>\n\n\n\n<p>By following these steps, you ensure that the Terms of Service are accepted automatically, and you retain control over whether to include a build scan in your Gradle build process.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>3,508 Views To accept the Gradle Terms of Service (ToS) for build &#8211;scan automatically and still manage to run the build without a scan, you can configure your Gradle build script and use command line options accordingly. Here are the steps: Option 2: Using environment variable: To run the build with a scan enabled, you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[71],"tags":[],"class_list":["post-8494","post","type-post","status-publish","format-standard","hentry","category-how-tos"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=8494"}],"version-history":[{"count":2,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8494\/revisions"}],"predecessor-version":[{"id":8496,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8494\/revisions\/8496"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=8494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=8494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=8494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}