Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.12.2] ./gradlew test not running unit tests

Featured Replies

Posted

I have unit tests written for my project that I typically run through my IDE (and assumed ran automatically in my CI environment since it runs gradlew check) but it turns out running check or test isn't actually running my tests.  I have a pretty standard setup - tests are located in <project root>/src/test/java/<package>/...

 

Here's my build.gradle:

buildscript {
  repositories {
    jcenter()
    maven { url = "http://files.minecraftforge.net/maven" }
  }
  dependencies {
    classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
  }
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.

ext.configFile = file "build.properties"
configFile.withReader {
  def prop = new Properties()
  prop.load(it)
  project.ext.config = new ConfigSlurper().parse prop
}

version = config.version
group= "lordmonoxide.gradient" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "gradient"

sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
compileJava {
  sourceCompatibility = targetCompatibility = "1.8"
}

minecraft {
  version = config.mc_version + "-" + config.forge_version
  runDir = "run"

  mappings = config.mappings_version
}

repositories {
  maven {
    //IC2
    name = "player-ic2"
    url = "http://maven.ic2.player.to/"
  }

  maven {
    name = "BuildCraft"
    url = "http://www.mod-buildcraft.com/maven"
  }

  maven {
    // JEI
    name = "Progwml6 maven"
    url = "http://dvs1.progwml6.com/files/maven"
  }
}

dependencies {
  // compile against the JEI API but do not include it at runtime
  deobfProvided 'mezz.jei:jei_1.12.2:4.13.1.220:api'
  // at runtime, use the full JEI jar
  runtime 'mezz.jei:jei_1.12.2:4.13.1.220'

  testCompile "org.junit.jupiter:junit-jupiter-api:5.3.2"
}

processResources {
  // 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'
  }
}

 

I'm pretty unfamiliar with gradle, am I missing anything?

 

Edit: just realised there's a gradle subforum, not sure if this belongs here or there...

Edited by Corey

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.