Minor code cleanup

This commit is contained in:
Erik C. Thauvin 2023-11-04 13:19:15 -07:00
parent 219645e2c4
commit 3e3d6dafec
6 changed files with 15 additions and 14 deletions

1
.idea/misc.xml generated
View file

@ -13,6 +13,7 @@
<option value="K:\java\semver\config\pmd.xml" /> <option value="K:\java\semver\config\pmd.xml" />
<option value="$PROJECT_DIR$/../bld-jacoco-report/config/pmd.xml" /> <option value="$PROJECT_DIR$/../bld-jacoco-report/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-checkstyle/config/pmd.xml" /> <option value="$PROJECT_DIR$/../bld-checkstyle/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-pitest/config/pmd.xml" />
</list> </list>
</option> </option>
<option name="skipTestSources" value="false" /> <option name="skipTestSources" value="false" />

View file

@ -46,4 +46,4 @@ Please check the [BootJarOperation documentation](https://rife2.github.io/bld-sp
or [BootWarOperation documentation](https://rife2.github.io/bld-spring-boot/rife/bld/extension/BootWarOperation.html#method-summary) or [BootWarOperation documentation](https://rife2.github.io/bld-spring-boot/rife/bld/extension/BootWarOperation.html#method-summary)
for all available configuration options. for all available configuration options.
You might also want to have a look at the [Spring Boot Web Application Example for bld](https://github.com/rife2/spring-boot-bld-example). You may also want to have a look at the [Spring Boot Web Application Example for bld](https://github.com/rife2/spring-boot-bld-example).

View file

@ -41,7 +41,7 @@ public class DemoApplicationBuild extends WebProject {
public static void main(String[] args) { public static void main(String[] args) {
var level = Level.ALL; var level = Level.ALL;
var logger = Logger.getLogger("rife.bld.extension"); var logger = Logger.getLogger("rife.bld.extension");
ConsoleHandler consoleHandler = new ConsoleHandler(); var consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(level); consoleHandler.setLevel(level);
logger.addHandler(consoleHandler); logger.addHandler(consoleHandler);
logger.setLevel(level); logger.setLevel(level);

View file

@ -250,11 +250,11 @@ public abstract class AbstractBootOperation<T extends AbstractBootOperation<T>>
/** /**
* Provides the libraries that will be stored in {@code BOOT-INF} or {@code WEB-INF}. * Provides the libraries that will be stored in {@code BOOT-INF} or {@code WEB-INF}.
* *
* @param jar one or more Java archive file * @param jars one or more Java archive files
* @return this operation instance * @return this operation instance
*/ */
public T infLibs(File... jar) { public T infLibs(File... jars) {
infLibs_.addAll(List.of(jar)); infLibs_.addAll(List.of(jars));
//noinspection unchecked //noinspection unchecked
return (T) this; return (T) this;
} }
@ -386,7 +386,7 @@ public abstract class AbstractBootOperation<T extends AbstractBootOperation<T>>
/** /**
* Provides source directories that will be used for the archive creation. * Provides source directories that will be used for the archive creation.
* *
* @param directories one or more source directory * @param directories one or more source directories
* @return this operation instance * @return this operation instance
*/ */
public T sourceDirectories(File... directories) { public T sourceDirectories(File... directories) {

View file

@ -35,12 +35,12 @@ public final class BootUtils {
} }
/** /**
* Deletes the given directory. * Deletes the given directories.
* *
* @param directory the directory to delete * @param directories one or more directories to delete
*/ */
public static void deleteDirectories(File... directory) throws FileUtilsErrorException { public static void deleteDirectories(File... directories) throws FileUtilsErrorException {
for (var d : directory) { for (var d : directories) {
if (d.exists()) { if (d.exists()) {
FileUtils.deleteDirectory(d); FileUtils.deleteDirectory(d);
} }

View file

@ -107,7 +107,6 @@ public class BootWarOperation extends AbstractBootOperation<BootWarOperation> {
.infLibs(project.compileClasspathJars()) .infLibs(project.compileClasspathJars())
.infLibs(project.runtimeClasspathJars()) .infLibs(project.runtimeClasspathJars())
.infLibs(project.buildDistDirectory()) .infLibs(project.buildDistDirectory())
// TODO add provided libs
.launcherClass("org.springframework.boot.loader.WarLauncher") .launcherClass("org.springframework.boot.loader.WarLauncher")
.launcherLibs(project.standaloneClasspathJars()) .launcherLibs(project.standaloneClasspathJars())
.mainClass(project.mainClass()) .mainClass(project.mainClass())
@ -116,6 +115,7 @@ public class BootWarOperation extends AbstractBootOperation<BootWarOperation> {
new BootManifestAttribute("Main-Class", launcherClass()), new BootManifestAttribute("Main-Class", launcherClass()),
new BootManifestAttribute("Start-Class", mainClass()) new BootManifestAttribute("Start-Class", mainClass())
)) ))
.providedLibs(project.providedClasspathJars())
.sourceDirectories(project.buildMainDirectory(), project.srcMainResourcesDirectory()); .sourceDirectories(project.buildMainDirectory(), project.srcMainResourcesDirectory());
} }
@ -133,11 +133,11 @@ public class BootWarOperation extends AbstractBootOperation<BootWarOperation> {
/** /**
* Provides the libraries that will be used for the WAR creation in {@code /WEB-INF/lib-provided}. * Provides the libraries that will be used for the WAR creation in {@code /WEB-INF/lib-provided}.
* *
* @param jar one or more Java archive file * @param jars one or more Java archive files
* @return this operation instance * @return this operation instance
*/ */
public BootWarOperation providedLibs(File... jar) { public BootWarOperation providedLibs(File... jars) {
providedLibs_.addAll(List.of(jar)); providedLibs_.addAll(List.of(jars));
return this; return this;
} }
} }