diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java index 0a60b05db..2cd43ed3c 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java @@ -76,8 +76,10 @@ public final boolean install(boolean silent, EnvironmentContext environmentConte VersionIdentifier installedVersion = getInstalledVersion(); Step step = this.context.newStep(silent, "Install " + this.tool, configuredVersion); try { + // TODO https://github.com/devonfw/IDEasy/issues/664 + boolean enableOptimization = false; // performance: avoid calling installTool if already up-to-date - if (configuredVersion.equals(installedVersion)) { // here we can add https://github.com/devonfw/IDEasy/issues/637 + if (enableOptimization & configuredVersion.equals(installedVersion)) { // here we can add https://github.com/devonfw/IDEasy/issues/637 return toolAlreadyInstalled(silent, installedVersion, step); } // install configured version of our tool in the software repository if not already installed @@ -239,8 +241,9 @@ public boolean installAsDependency(VersionRange version, EnvironmentContext envi "Cannot satisfy dependency to " + this.tool + " in version " + version + " since it is conflicting with configured version " + configuredVersion + " and this tool does not support the software repository."); } - this.context.info("Configured version is {} but does not match version to install {} - need to use different version from software repository.", - configuredVersion, version); + this.context.info( + "Configured version of tool {} is {} but does not match version to install {} - need to use different version from software repository.", + this.tool, configuredVersion, version); } ToolInstallation toolInstallation = installTool(version, environmentContext); return toolInstallation.newInstallation(); diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/tomcat/Tomcat.java b/cli/src/main/java/com/devonfw/tools/ide/tool/tomcat/Tomcat.java index 1283823c4..109e10634 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/tomcat/Tomcat.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/tomcat/Tomcat.java @@ -43,10 +43,14 @@ public Tomcat(IdeContext context) { public ProcessResult runTool(ProcessMode processMode, GenericVersionRange toolVersion, ProcessErrorHandling errorHandling, String... args) { if (args.length == 0) { - args = new String[] { "start" }; + args = new String[] { "run" }; + } + boolean startup = args[0].equals("start") || args[0].equals("run"); + if (startup) { + processMode = ProcessMode.BACKGROUND; } ProcessResult processResult = super.runTool(processMode, toolVersion, errorHandling, args); - if (processResult.isSuccessful() && (args[0].equals("start") || args[0].equals("run"))) { + if (processResult.isSuccessful() && startup) { printTomcatPort(); } return processResult; @@ -60,9 +64,16 @@ protected void setEnvironment(EnvironmentContext environmentContext, ToolInstall } @Override - public String getBinaryName() { - - return "catalina.sh"; + protected void postExtract(Path extractedDir) { + + super.postExtract(extractedDir); + String binaryName; + if (this.context.getSystemInfo().isWindows()) { + binaryName = "catalina.bat"; + } else { + binaryName = "catalina.sh"; + } + createStartScript(extractedDir, binaryName, false); } private void printTomcatPort() { diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java index 1aca04564..4eba5edba 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java @@ -126,6 +126,7 @@ public void testIntellijRun(String os, WireMockRuntimeInfo wmRuntimeInfo) throws SystemInfo systemInfo = SystemInfoMock.of(os); this.context.setSystemInfo(systemInfo); Intellij commandlet = new Intellij(this.context); + this.context.info("Starting testIntellijRun on {}", os); // act commandlet.run(); diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/tomcat/TomcatTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/tomcat/TomcatTest.java index 7755786c8..8e1bccb65 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/tomcat/TomcatTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/tomcat/TomcatTest.java @@ -51,12 +51,13 @@ public void testTomcat() { new IdeLogEntry(IdeLogLevel.SUCCESS, "Successfully installed java in version " + javaVersionProject), // new IdeLogEntry(IdeLogLevel.INFO, "OpenJDK version " + javaVersionProject), // new IdeLogEntry(IdeLogLevel.INFO, - "Configured version is 8u402b06 but does not match version to install [11,22) - need to use different version from software repository."), // + "Configured version of tool java is 8u402b06 but does not match version to install [11,22) - need to use different version from software repository."), + // new IdeLogEntry(IdeLogLevel.DEBUG, "Installed java in version " + javaVersionTomcat + " at ", true), new IdeLogEntry(IdeLogLevel.SUCCESS, "Successfully installed tomcat in version " + tomcatVersion), // new IdeLogEntry(IdeLogLevel.INFO, "OpenJDK version " + javaVersionTomcat), // new IdeLogEntry(IdeLogLevel.INFO, "JAVA_HOME=" + javaTomcatPath), // - new IdeLogEntry(IdeLogLevel.INFO, "tomcat start"), // + new IdeLogEntry(IdeLogLevel.INFO, "tomcat run"), // new IdeLogEntry(IdeLogLevel.INFO, "Tomcat is running at localhost on HTTP port " + tomcatPort + ":"), // new IdeLogEntry(IdeLogLevel.INFO, "http://localhost:" + tomcatPort) // ); diff --git a/cli/src/test/resources/ide-projects/intellij/_ide/urls/intellij/intellij/2023.3.3/urls b/cli/src/test/resources/ide-projects/intellij/_ide/urls/intellij/intellij/2023.3.3/urls new file mode 100644 index 000000000..f071ff618 --- /dev/null +++ b/cli/src/test/resources/ide-projects/intellij/_ide/urls/intellij/intellij/2023.3.3/urls @@ -0,0 +1 @@ +https://download.jetbrains.com/idea/ideaC-2023.3.3.win.zip diff --git a/cli/src/test/resources/ide-projects/intellij/_ide/urls/java/java/17.0.10_7/urls b/cli/src/test/resources/ide-projects/intellij/_ide/urls/java/java/17.0.10_7/urls new file mode 100644 index 000000000..b21ed4505 --- /dev/null +++ b/cli/src/test/resources/ide-projects/intellij/_ide/urls/java/java/17.0.10_7/urls @@ -0,0 +1 @@ +https://adoptium.net/download/dummytest diff --git a/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/linux/bin/idea.sh b/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/linux/bin/idea.sh index 145bf5eb5..89d12aafe 100755 --- a/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/linux/bin/idea.sh +++ b/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/linux/bin/idea.sh @@ -1,3 +1,5 @@ #!/bin/bash cd "$(dirname "$0")" +echo $PWD +echo "intellij linux $*" echo "intellij linux $*" > intellijtest diff --git a/cli/src/test/resources/ide-projects/tomcat/repository/java/java/default/bin/java.bat b/cli/src/test/resources/ide-projects/tomcat/repository/java/java/default/bin/java.bat new file mode 100644 index 000000000..501dd73dd --- /dev/null +++ b/cli/src/test/resources/ide-projects/tomcat/repository/java/java/default/bin/java.bat @@ -0,0 +1,6 @@ +@echo off +if "%1%" == "--version" ( + for /f "delims=" %%i in (%~dp0..\.ide.software.version) do @echo OpenJDK version %%i +) else ( + echo java %* +) diff --git a/cli/src/test/resources/ide-projects/tomcat/repository/tomcat/tomcat/default/bin/catalina.bat b/cli/src/test/resources/ide-projects/tomcat/repository/tomcat/tomcat/default/bin/catalina.bat index 5fc84a864..9a2f67d76 100644 --- a/cli/src/test/resources/ide-projects/tomcat/repository/tomcat/tomcat/default/bin/catalina.bat +++ b/cli/src/test/resources/ide-projects/tomcat/repository/tomcat/tomcat/default/bin/catalina.bat @@ -1 +1,4 @@ -@echo test for windows \ No newline at end of file +@echo off +call java --version +echo JAVA_HOME=%JAVA_HOME% +echo tomcat %* diff --git a/cli/src/test/resources/ide-projects/tomcat/repository/tomcat/tomcat/default/bin/catalina.sh b/cli/src/test/resources/ide-projects/tomcat/repository/tomcat/tomcat/default/bin/catalina.sh old mode 100644 new mode 100755