batman
batman

Reputation: 4928

Jar building doesn't work in Gradle

I'm very new to Gradle and I have the project structure like this:

Project Name
   src
     package1 
       .java
     package2
       .java

My gradle build looks like this:

apply plugin: 'java'

version = 0.1
sourceCompatibility = 1.6

sourceSets {
    main {
        java {
            srcDir 'src/*'
        }
    }
}

And when I run gradle jar the jar is been created. But looking the jar, it has only the MANIFEST folder, not the compiled classes.

Where I'm making mistake?

Upvotes: 0

Views: 237

Answers (2)

user745733
user745733

Reputation:

When you are new to gradle I'd advice you to use the standards (convention over configuration) part - so put your Java sources in src/main/java - and you do not need the sourceSets part.

If you want to use it, check http://www.gradle.org/docs/current/userguide/java_plugin.html

Upvotes: 1

Peter Niederwieser
Peter Niederwieser

Reputation: 123996

srcDir doesn't accept wildcards. (Where did you get this from?) Try srcDirs = ['src']. (This will override the default directory, rather than adding another one.)

Upvotes: 2

Related Questions