Skip to content

Commit

Permalink
classes, lib: -> WEB-INF (#934)
Browse files Browse the repository at this point in the history
The classes and lib directories belong under the WEB-INF directory
(rather than the root) of the .war file.
  • Loading branch information
earldouglas authored Sep 25, 2024
1 parent 47153c0 commit a3b0338
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/com/earldouglas/sbt/war/WarPackage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object WarPackage {
): Seq[(File, String)] =
Seq(
webappResources,
webappClasses.map { case (k, v) => k -> s"classes/${v}" },
webappLib.map { case (k, v) => k -> s"lib/${v}" }
webappClasses.map { case (k, v) => k -> s"WEB-INF/classes/${v}" },
webappLib.map { case (k, v) => k -> s"WEB-INF/lib/${v}" }
).flatten
}
86 changes: 43 additions & 43 deletions src/sbt-test/sbt-war/combined/scenarios/war-package-plugin.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -43,52 +43,52 @@ lazy val checkWar: Def.Initialize[Task[Unit]] =
Set(
"META-INF/MANIFEST.MF",
"WEB-INF/",
"WEB-INF/classes/",
"WEB-INF/classes/domain/",
"WEB-INF/classes/domain/entities/",
"WEB-INF/classes/domain/entities/Count$.class",
"WEB-INF/classes/domain/entities/Count.class",
"WEB-INF/classes/domain/entities/Count.tasty",
"WEB-INF/classes/domain/operations/",
"WEB-INF/classes/domain/operations/Counter.class",
"WEB-INF/classes/domain/operations/Counter.tasty",
"WEB-INF/classes/drivers/",
"WEB-INF/classes/drivers/db/",
"WEB-INF/classes/drivers/db/Transactor.class",
"WEB-INF/classes/drivers/db/Transactor.tasty",
"WEB-INF/classes/drivers/db/db$package$$anon$1$$anon$2.class",
"WEB-INF/classes/drivers/db/db$package$$anon$1.class",
"WEB-INF/classes/drivers/db/db$package$.class",
"WEB-INF/classes/drivers/db/db$package.class",
"WEB-INF/classes/drivers/db/db$package.tasty",
"WEB-INF/classes/drivers/mem/",
"WEB-INF/classes/drivers/mem/mem$package$$anon$1$$anon$2.class",
"WEB-INF/classes/drivers/mem/mem$package$$anon$1.class",
"WEB-INF/classes/drivers/mem/mem$package$.class",
"WEB-INF/classes/drivers/mem/mem$package.class",
"WEB-INF/classes/drivers/mem/mem$package.tasty",
"WEB-INF/classes/runners/",
"WEB-INF/classes/runners/Main$$anon$1.class",
"WEB-INF/classes/runners/Main$tx$.class",
"WEB-INF/classes/runners/Main.class",
"WEB-INF/classes/runners/Main.tasty",
"WEB-INF/classes/runners/MainServlet.class",
"WEB-INF/classes/runners/MainServlet.tasty",
"WEB-INF/classes/usecases/",
"WEB-INF/classes/usecases/Counter.class",
"WEB-INF/classes/usecases/Counter.tasty",
"WEB-INF/lib/",
"WEB-INF/lib/cats-core_3-2.9.0.jar",
"WEB-INF/lib/cats-effect-kernel_3-3.5.4.jar",
"WEB-INF/lib/cats-effect-std_3-3.5.4.jar",
"WEB-INF/lib/cats-effect_3-3.5.4.jar",
"WEB-INF/lib/cats-kernel_3-2.9.0.jar",
"WEB-INF/lib/h2-2.2.224.jar",
"WEB-INF/lib/scala-library-2.13.14.jar",
"WEB-INF/lib/scala3-library_3-3.5.0.jar",
"WEB-INF/web.xml",
"classes/",
"classes/domain/",
"classes/domain/entities/",
"classes/domain/entities/Count$.class",
"classes/domain/entities/Count.class",
"classes/domain/entities/Count.tasty",
"classes/domain/operations/",
"classes/domain/operations/Counter.class",
"classes/domain/operations/Counter.tasty",
"classes/drivers/",
"classes/drivers/db/",
"classes/drivers/db/Transactor.class",
"classes/drivers/db/Transactor.tasty",
"classes/drivers/db/db$package$$anon$1$$anon$2.class",
"classes/drivers/db/db$package$$anon$1.class",
"classes/drivers/db/db$package$.class",
"classes/drivers/db/db$package.class",
"classes/drivers/db/db$package.tasty",
"classes/drivers/mem/",
"classes/drivers/mem/mem$package$$anon$1$$anon$2.class",
"classes/drivers/mem/mem$package$$anon$1.class",
"classes/drivers/mem/mem$package$.class",
"classes/drivers/mem/mem$package.class",
"classes/drivers/mem/mem$package.tasty",
"classes/runners/",
"classes/runners/Main$$anon$1.class",
"classes/runners/Main$tx$.class",
"classes/runners/Main.class",
"classes/runners/Main.tasty",
"classes/runners/MainServlet.class",
"classes/runners/MainServlet.tasty",
"classes/usecases/",
"classes/usecases/Counter.class",
"classes/usecases/Counter.tasty",
"favicon.ico",
"index.html",
"lib/",
"lib/cats-core_3-2.9.0.jar",
"lib/cats-effect-kernel_3-3.5.4.jar",
"lib/cats-effect-std_3-3.5.4.jar",
"lib/cats-effect_3-3.5.4.jar",
"lib/cats-kernel_3-2.9.0.jar",
"lib/h2-2.2.224.jar",
"lib/scala-library-2.13.14.jar",
"lib/scala3-library_3-3.5.0.jar",
"styles/",
"styles/theme.css"
)
Expand Down
8 changes: 4 additions & 4 deletions src/test/scala/com/earldouglas/sbt/war/WarPackageTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class WarPackageTest extends AnyFunSuite with Matchers {
"src/test/fakeproject/src/main/webapp/foo.html" -> "foo.html",
"src/test/fakeproject/src/main/webapp/bar.html" -> "bar.html",
"src/test/fakeproject/src/main/webapp/baz/raz.css" -> "baz/raz.css",
"src/test/fakeproject/classes/foo.class" -> "classes/foo.class",
"src/test/fakeproject/classes/bar.class" -> "classes/bar.class",
"src/test/fakeproject/lib/baz.jar" -> "lib/baz.jar",
"src/test/fakeproject/lib/raz.jar" -> "lib/raz.jar"
"src/test/fakeproject/classes/foo.class" -> "WEB-INF/classes/foo.class",
"src/test/fakeproject/classes/bar.class" -> "WEB-INF/classes/bar.class",
"src/test/fakeproject/lib/baz.jar" -> "WEB-INF/lib/baz.jar",
"src/test/fakeproject/lib/raz.jar" -> "WEB-INF/lib/raz.jar"
).map { case (src, dst) => new File(src) -> dst }

val obtained: Seq[(File, String)] =
Expand Down

0 comments on commit a3b0338

Please sign in to comment.