DirtyMikeAndTheBoys
DirtyMikeAndTheBoys

Reputation: 1077

Gradle buildscript cannot "compile build" my app

Here's my build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.0.1')
    }
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'

group = 'com.myapp'
version = '0.1.0'

dependencies {
    compile 'org.slf4j:slf4j-api:1.7.5'
    testCompile 'junit:junit:4.11'
}

task sourcesJar(type: Jar, dependsOn: classes) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

publishing {
    publications {
        main(MavenPublication) {
            from components.java
            artifact sourcesJar
        }
    }

    artifactory {
        contextUrl = 'http://myprivaterepo'
        resolve {
            repository {
                repoKey = 'myteam-snapshot'
            }
        }
        publish {
            repository {
                repoKey = 'myteam-snapshot'
            }
            defaults {
                publications 'main'
            }
        }
    }

When I run gradle jar --stacktrace (I'm attempting to simply compile and package a JAR locally) I get:

org.gradle.groovy.scripts.ScriptCompilationException: Could not compile build file 'C:\Users\myuser\com\myapp\build.gradle'.
    at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.wrapCompilationFailure(DefaultScriptCompilationHandler.java:151)
    at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:117)
    at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileToDir(DefaultScriptCompilationHandler.java:64)
    at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CacheInitializer.execute(FileCacheBackedScriptClassCompiler.java:95)
    at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CacheInitializer.execute(FileCacheBackedScriptClassCompiler.java:80)
    ...rest of stack trace omitted for brevity

Can anybody see what's going on here?

Upvotes: 0

Views: 3615

Answers (1)

The End
The End

Reputation: 709

You are missing a closing bracket for the publishing closure. Or you just missed it at the copy paste.

Upvotes: 2

Related Questions