Skip to content

Commit

Permalink
removing use of deprecated plugin conventions
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Venmany <[email protected]>
  • Loading branch information
arunvenmany-ibm committed Sep 10, 2024
1 parent f80eb88 commit 10d24a3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ class DeployTask extends AbstractServerTask {
}
}

LooseWarApplication looseWar = new LooseWarApplication(task, config)
LooseWarApplication looseWar = new LooseWarApplication(task, config,logger)
looseWar.addSourceDir()
looseWar.addOutputDir(looseWar.getDocumentRoot() , task.classpath.getFiles().toArray()[0], "/WEB-INF/classes/");

Expand Down Expand Up @@ -403,7 +403,7 @@ class DeployTask extends AbstractServerTask {
}

protected void installLooseConfigEar(LooseConfigData config, Task task) throws Exception{
LooseEarApplication looseEar = new LooseEarApplication(task, config);
LooseEarApplication looseEar = new LooseEarApplication(task, config, logger);
looseEar.addSourceDir();
looseEar.addApplicationXmlFile();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ import io.openliberty.tools.common.plugins.config.LooseConfigData
import org.apache.commons.io.FilenameUtils
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.logging.Logger
import org.gradle.plugins.ear.Ear
import org.w3c.dom.Element

public class LooseEarApplication extends LooseApplication {

protected Task task;
protected Logger logger;

public LooseEarApplication(Task task, LooseConfigData config) {
public LooseEarApplication(Task task, LooseConfigData config, Logger logger) {
super(task.getProject().getLayout().getBuildDirectory().getAsFile().get().getAbsolutePath(), config)
this.task = task
this.logger = logger
}

public void addSourceDir() throws Exception {
Expand All @@ -40,6 +43,9 @@ public class LooseEarApplication extends LooseApplication {
config.addFile(applicationXmlFile, "/META-INF/application.xml");
}
}
else {
logger.warn("Project is expected to have EAR plugin. Application xml file may not be added correctly")
}
}

public Element addWarModule(Project proj) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ package io.openliberty.tools.gradle.utils;
import io.openliberty.tools.common.plugins.config.LooseApplication
import io.openliberty.tools.common.plugins.config.LooseConfigData
import org.gradle.api.Task
import org.gradle.api.logging.Logger
import org.gradle.api.tasks.bundling.War

public class LooseWarApplication extends LooseApplication {

protected Task task;
protected Logger logger;

public LooseWarApplication(Task task, LooseConfigData config) {
public LooseWarApplication(Task task, LooseConfigData config, Logger logger) {
super(task.getProject().getLayout().getBuildDirectory().getAsFile().get().getAbsolutePath(), config)
this.task = task
this.logger = logger
}

public void addSourceDir() throws Exception {
Expand All @@ -23,6 +26,8 @@ public class LooseWarApplication extends LooseApplication {
if (war.getWebAppDirectory().getAsFile().get() != null) {
sourceDir = new File(war.getWebAppDirectory().getAsFile().get().getAbsolutePath())
}
}else {
logger.warn("Default sourcedir path to src/main/webapp as WAR plugin does not exist. Application may not work expectedly")
}
config.addDir(sourceDir, "/")
}
Expand Down

0 comments on commit 10d24a3

Please sign in to comment.