A Redfearn
A Redfearn

Reputation: 528

Package ratpack.test does not exist

I have a Gradle, Intellij-idea project and I'm using ratpack. I'm trying to use the ratpack.test library to test my API however it cannot seem to find the ratpack.test package.

When compiling it says package ratpack.test does not exist.

Gradle: io.ratpack:ratpack-test 1.7.5 is in my external libraries and module.

Upon the error if I hover over the ratpack.test import it says add library 'Gradle: io.ratpack:ratpack-test 1.7.5' to classpath which I click. Then when I try to build again it breaks with the same error.

build.gradle file

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "io.ratpack:ratpack-gradle:1.7.5"
    }
}

plugins {
    id 'java'
}

group 'MIR.Interviwer.API'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    jcenter()
}

apply plugin: "io.ratpack.ratpack-java"
apply plugin: "idea"

dependencies {
    testCompile 'junit:junit:4.12'
    compile 'junit:junit:4.12'
    runtime "org.slf4j:slf4j-simple:1.7.25"
    runtime "com.h2database:h2:1.4.199"
}

ratpack.baseDir = file('ratpack')

Any ideas? Thanks.

Upvotes: 0

Views: 203

Answers (1)

Bjørn Vester
Bjørn Vester

Reputation: 7600

The only thing I can think of is if you are attempting to import the Ratpack test classes in your main module, where they are not available (after all, they are test classes and are only available in the test module).

Just as a heads up, you are also using deprecated configurations. So unless you are in a legacy project with an old version, use these instead:

  • testCompile -> testImplementation
  • compile -> implementation
  • runtime -> runtimeOnly

You can also get rid of the entire buildscript block and the apply plugin: "io.ratpack.ratpack-java" line, and just type:

plugins {
  id "io.ratpack.ratpack-java" version "1.7.5"
}

Upvotes: 2

Related Questions