Ear change compiled output folder to APP-INF/classes

I’m using the ear plugin, and currently it is copying my compiled .class files into the root folder of the ear.
I want it to be in a subfolder (APP-INF/classes)

how can I accomplish this?

Hello @ohull1

if i understand you correctly then use this

libDirName 'APP-INF/classes'

and here the doc for it
https://docs.gradle.org/current/userguide/ear_plugin.html#sec:ear_convention_properties

hope that help and have a nice day :slight_smile:

from what I understand that would change the folder of the jar dependencies not my compiled source code

then sorry for my miss understanding

i think you could use this

https://docs.gradle.org/current/dsl/org.gradle.plugins.ear.Ear.html#org.gradle.plugins.ear.Ear:eachFile(org.gradle.api.Action)

then check if the file end with .class then change it’s copyTo

and have a nice day :slight_smile:

1 Like

This worked! I used the following code in my ear task:

    includeEmptyDirs = false

    filesMatching("*/**/*.class") {
        it.setPath("APP-INF/classes/" + it.path)
    }
1 Like

@ohull1 well done and congratulations