Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ according to your preferences.
<br >If the paths are not provided, your IDE's `PATH` and `JAVA_HONE` environments will be used to locate the
executables.

- **Maven Wrappers** :
<br >`preferWrapper`: Configure whether to use Maven wrapper. There are three options available:
<br >`true`: Always use the wrapper regardless of `Build,Execution,Deployment › Build Tools > Maven: Maven home path` setting
<br >`false`: Never use the wrapper regardless of `Build,Execution,Deployment › Build Tools > Maven: Maven home path` setting
<br >`fallback`: Use IntelliJ's `Build,Execution,Deployment › Build Tools > Maven: Maven home path` setting (default behavior)

- **Node** :
<br >Set the full path of the Node executable, which allows Exhort to locate and run one of the corresponding `npm`, `pnpm` or `yarn` command to resolve
dependencies for Node projects.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ideaVersion=2025.1
gradleVersion=8.5

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
platformBundledPlugins=org.jetbrains.plugins.yaml,com.intellij.java
platformBundledPlugins=org.jetbrains.plugins.yaml,com.intellij.java,org.jetbrains.idea.maven
platformPlugins=com.redhat.devtools.intellij.telemetry:1.1.0.52,org.jetbrains.plugins.go:251.23774.200,Docker:251.23774.37

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/org/jboss/tools/intellij/exhort/ApiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.redhat.exhort.api.v4.AnalysisReport;
import com.redhat.exhort.impl.ExhortApi;
import org.jboss.tools.intellij.settings.ApiSettingsState;
import org.jboss.tools.intellij.settings.MavenSettingsUtil;

import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -133,7 +134,20 @@ private void setRequestProperties(final String manifestName) {
} else {
System.clearProperty("EXHORT_MVN_PATH");
}
if (settings.gradlePath != null && !settings.gradlePath.isBlank()) {

if (settings.useMavenWrapper.equals("fallback")) {
if (MavenSettingsUtil.isMavenWrapperSelected()) {
System.setProperty("EXHORT_PREFER_MVNW", settings.useMavenWrapper);
} else {
System.clearProperty("EXHORT_PREFER_MVNW");
}
} else if (settings.useMavenWrapper.equals("true")) {
System.setProperty("EXHORT_PREFER_MVNW", settings.useMavenWrapper);
} else {
System.clearProperty("EXHORT_PREFER_MVNW");
}

if (settings.gradlePath != null && !settings.gradlePath.isBlank()) {
System.setProperty("EXHORT_GRADLE_PATH", settings.gradlePath);
} else {
System.clearProperty("EXHORT_GRADLE_PATH");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package org.jboss.tools.intellij.settings;

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.ui.TextComponentAccessor;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.ui.components.JBCheckBox;
Expand All @@ -27,6 +28,10 @@ public class ApiSettingsComponent {

private final static String mvnPathLabel = "<html>Maven > Executable: <b>Path</b>"
+ "<br>Specifies absolute path of <b>mvn</b> executable.</html>";
private final static String useMavenWrapperLabel = "<html>Maven: <b>Prefer Wrapper</b>"
+ "<br>Specifies whether to use the local maven wrapper."
+ "<br>The 'fallback' option will default to Build,Execution,Deployment › Build Tools > Maven: Maven home path setting"
+ "<br>Else defaulting to 'true'.</html>";
private final static String javaPathLabel = "<html>Maven > JAVA_HOME: <b>Path</b>"
+ "<br>Specifies absolute path of Java installation directory.</html>";
private final static String npmPathLabel = "<html>Npm > Executable: <b>Path</b>"
Expand Down Expand Up @@ -73,6 +78,7 @@ public class ApiSettingsComponent {
private final JPanel mainPanel;

private final TextFieldWithBrowseButton mvnPathText;
private final ComboBox useMavenWrapperCombo;
private final TextFieldWithBrowseButton javaPathText;
private final TextFieldWithBrowseButton npmPathText;
private final TextFieldWithBrowseButton pnpmPathText;
Expand Down Expand Up @@ -108,6 +114,10 @@ public ApiSettingsComponent() {
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT
);

useMavenWrapperCombo = new ComboBox<>(new String[]{"fallback", "true", "false"});
useMavenWrapperCombo.setEditable(false);
useMavenWrapperCombo.setSelectedIndex(0);

javaPathText = new TextFieldWithBrowseButton();
javaPathText.addBrowseFolderListener(
null,
Expand Down Expand Up @@ -257,6 +267,8 @@ public ApiSettingsComponent() {
mainPanel = FormBuilder.createFormBuilder()
.addLabeledComponent(new JBLabel(mvnPathLabel), mvnPathText, 1, true)
.addVerticalGap(10)
.addLabeledComponent(new JBLabel(useMavenWrapperLabel), useMavenWrapperCombo, 1, true)
.addVerticalGap(10)
.addLabeledComponent(new JBLabel(javaPathLabel), javaPathText, 1, true)
.addSeparator(10)
.addVerticalGap(10)
Expand Down Expand Up @@ -324,6 +336,14 @@ public void setMvnPathText(@NotNull String text) {
mvnPathText.setText(text);
}

public String getUseMavenWrapperCombo() {
return useMavenWrapperCombo.getSelectedItem().toString();
}

public void setUseMavenWrapperCombo(@NotNull String text) {
useMavenWrapperCombo.setSelectedItem(text);
}

@NotNull
public String getJavaPathText() {
return javaPathText.getText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public JComponent getPreferredFocusedComponent() {
public boolean isModified() {
ApiSettingsState settings = ApiSettingsState.getInstance();
boolean modified = !settingsComponent.getMvnPathText().equals(settings.mvnPath);
modified |= settingsComponent.getUseMavenWrapperCombo() != settings.useMavenWrapper;
modified |= !settingsComponent.getJavaPathText().equals(settings.javaPath);
modified |= !settingsComponent.getNpmPathText().equals(settings.npmPath);
modified |= !settingsComponent.getPnpmPathText().equals(settings.pnpmPath);
Expand Down Expand Up @@ -68,6 +69,7 @@ public boolean isModified() {
public void apply() {
ApiSettingsState settings = ApiSettingsState.getInstance();
settings.mvnPath = settingsComponent.getMvnPathText();
settings.useMavenWrapper = settingsComponent.getUseMavenWrapperCombo();
settings.javaPath = settingsComponent.getJavaPathText();
settings.npmPath = settingsComponent.getNpmPathText();
settings.pnpmPath = settingsComponent.getPnpmPathText();
Expand Down Expand Up @@ -95,6 +97,7 @@ public void apply() {
public void reset() {
ApiSettingsState settings = ApiSettingsState.getInstance();
settingsComponent.setMvnPathText(settings.mvnPath != null ? settings.mvnPath : "");
settingsComponent.setUseMavenWrapperCombo(settings.useMavenWrapper);
settingsComponent.setJavaPathText(settings.javaPath != null ? settings.javaPath : "");
settingsComponent.setNpmPathText(settings.npmPath != null ? settings.npmPath : "");
settingsComponent.setPnpmPathText(settings.pnpmPath != null ? settings.pnpmPath : "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public final class ApiSettingsState implements PersistentStateComponent<ApiSetti
public String rhdaToken;

public String mvnPath;
public String useMavenWrapper = "fallback";
public String javaPath;

public String npmPath;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.jboss.tools.intellij.settings;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.project.MavenGeneralSettings;
import org.jetbrains.idea.maven.project.MavenHomeType;
import org.jetbrains.idea.maven.project.MavenWorkspaceSettingsComponent;
import org.jetbrains.idea.maven.project.MavenWrapper;

public final class MavenSettingsUtil {

private MavenSettingsUtil() {
// no‑op
}

@Nullable
public static boolean isMavenWrapperSelected() {
Project project;
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
if (openProjects.length > 0) {
project = openProjects[0];
} else {
project = ProjectManager.getInstance().getDefaultProject();
}
MavenGeneralSettings settings = MavenWorkspaceSettingsComponent.getInstance(project).getSettings().getGeneralSettings();
MavenHomeType mavenHomeType = settings.getMavenHomeType();
return mavenHomeType instanceof MavenWrapper;
}
}
11 changes: 11 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@
<br>If the paths are not provided, your IDE's <code>PATH</code> and <code>JAVA_HONE</code> environments will be
used to locate the executables.
</li>

<li>
<b>Maven Wrapper</b>:
<br><code>preferWrapper</code> : Configure whether to use Maven wrapper. There are three options available
<br><code>true</code>: Always use the wrapper regardless of Build,Execution,Deployment › Build Tools > Maven: Maven home path setting
<br><code>false</code>: Never use the wrapper regardless of Build,Execution,Deployment › Build Tools > Maven: Maven home path setting
<br><code>fallback</code>: Use IntelliJ's Build,Execution,Deployment › Build Tools > Maven: Maven home path setting (default behavior)
</li>

<li>
<b>Node</b>:
<br>Set the full path of the Node executable, which allows Exhort to locate and execute one of the corresponding <code>npm</code>, <code>pnpm</code> or <code>yarn</code> command
Expand Down Expand Up @@ -421,6 +430,8 @@
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<depends>com.intellij.modules.lang</depends>
<depends>com.intellij.java</depends>
<depends>org.jetbrains.idea.maven</depends>
<depends>com.redhat.devtools.intellij.telemetry</depends>
<depends>Docker</depends>
<depends config-file="go.xml" optional="true">org.jetbrains.plugins.go</depends>
Expand Down
Loading