github.com/lineaje-labs/syft@v0.98.1-0.20231227153149-9e393f60ff1b/syft/pkg/cataloger/java/test-fixtures/gradle/build.gradle (about)

     1  plugins {
     2      id 'java'
     3      id 'eclipse'
     4      id 'application'
     5  }
     6  
     7  mainClassName = 'hello.HelloWorld'
     8  
     9  dependencyLocking {
    10      lockAllConfigurations()
    11  }
    12  // tag::repositories[]
    13  repositories {
    14      mavenCentral()
    15  }
    16  // end::repositories[]
    17  
    18  // tag::dependencies[]
    19  sourceCompatibility = 1.8
    20  targetCompatibility = 1.8
    21  
    22  dependencies {
    23      implementation "joda-time:joda-time:2.2"
    24      testImplementation "junit:junit:4.12"
    25  }
    26  // end::dependencies[]
    27  
    28  // tag::jar[]
    29  jar {
    30      archivesBaseName = 'example-java-app-gradle'
    31      version =  '0.1.0'
    32      manifest {
    33          attributes(
    34          'Main-Class': 'hello.HelloWorld'
    35          )
    36      }
    37      from {
    38          configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    39      }
    40  }
    41  // end::jar[]
    42  
    43  // tag::wrapper[]
    44  // end::wrapper[]
    45  
    46  // to invoke: gradle resolveAndLockAll --write-locks
    47  tasks.register('resolveAndLockAll') {
    48      notCompatibleWithConfigurationCache("Filters configurations at execution time")
    49      doFirst {
    50          assert gradle.startParameter.writeDependencyLocks
    51      }
    52      doLast {
    53          configurations.findAll {
    54              // Add any custom filtering on the configurations to be resolved
    55              it.canBeResolved
    56          }.each { it.resolve() }
    57      }
    58  }