Jump to content

Compiler copies .java Files


Recommended Posts

Heyho Guys!


I have seven Mods compiled and ready to download but now I recognised, that gradle copied the .java files into the jar. I don't want this to happen because it takes much memory space. I think the problem is my build.gradle file where I entered

buildscript {
    repositories {
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'

apply plugin: 'forge'

version = "x.x.x-mcx.x.x"
group= "com.bedrockminer.modid"
archivesBaseName = "Modname"

sourceSets {
    main {
        java { srcDirs = ["$projectDir/src"] }
resources { srcDirs = ["$projectDir/src"] } //Same directory as java!

minecraft {
    version = "1.7.2-"
    assetDir = "eclipse/assets"

    // this will ensure that this task is redone when the versions change.
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    // replace stuff in mcmod.info, nothing else
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
        // replace version and mcversion
        expand 'version':project.version, 'mcversion':project.minecraft.version
    // copy everything else, thats not the mcmod.info
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'


If I change the asset path to $projectDir/src/assets the assets are directly copied into the jar without the assets folder.

What can I do to exclude the .java files from the mod but copy the assets correctly?

Link to comment
Share on other sites

Use the standard setup -.-

ALL resources are copied into the resulting jar -.- So if you tell it your source files are resources it'll copy them.

Separate your resources from your code, as we have in the example mod.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.