11

My build output is out/production/classes. Java files get compiled into classes just fine and get put on out/production/classes/[packageName], but resources aren't copied. As far as I know they should go directly inside the out/production/classes directory.

Resources aren't copied

If relevant, I'm using Java 11, Spring Boot and Gradle. This is my build.gradle

plugins {
    id 'org.springframework.boot' version '2.1.3.RELEASE'
    id 'java'
}

apply plugin: 'io.spring.dependency-management'

group = 'net.impfox'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    // hidden
}

And my Compiler settings:

Compiler settings

What could be the cause for my resources not being copied to the output directory and how can I fix this?

Impulse The Fox
  • 2,638
  • 2
  • 27
  • 52
  • 2
    [Can't reproduce](https://i.imgur.com/gzBDBF5.png). Please share the [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and specify your IntelliJ IDEA/Gradle versions. – CrazyCoder Apr 16 '19 at 21:22
  • 1
    I've had issues like this before. Try adding the following to your `build.gradle`: `idea { module { inheritOutputDirs = true } }`. You might need `apply plugin: 'idea'` as well. – Jacob G. Apr 16 '19 at 22:29

2 Answers2

9

If someone is having this issue in Maven. I fixed it by changing the

<packaging>pom</packaging>

to

<packaging>jar</packaging>

In pom.xml

I copied a pom.xml from a maven moduler project (in main pom.xml it uses pom as packaging). Guess I learned my lesson.

5

I was not able to find the root problem, but I've got a guess. I renamed the entire project before and replaced every occurence of the old project name with the new one. Maybe some internal cache still had the old name inside?

I ended up cloning the project from version control, now it works.

Impulse The Fox
  • 2,638
  • 2
  • 27
  • 52