Skip to content

Commit

Permalink
Force update of Maven Modules when project opens, by using a listener
Browse files Browse the repository at this point in the history
  • Loading branch information
felladrin committed Nov 14, 2022
1 parent 88585f3 commit ecb13e3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
// Licensed under the GNU Affero General Public License (AGPL).
// See License-AGPL.txt in the project root for license information.

package io.gitpod.jetbrains.remote.maven
package io.gitpod.jetbrains.remote.optional

import com.intellij.openapi.project.Project
import org.jetbrains.idea.maven.project.MavenProjectsManager
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.project.ProjectManagerListener

class GitpodMavenProjectManager(project: Project) {

init {
class GitpodMavenProjectManagerListener : ProjectManagerListener {
@Deprecated("Deprecated. Need to findout the best way to replace it")
override fun projectOpened(project: Project) {
thisLogger().warn("gitpod: forcing initialization of maven project")
MavenProjectsManager.getInstance(project).forceUpdateAllProjectsOrFindAllAvailablePomFiles()
thisLogger().warn("gitpod: forced!")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
-->
<!--suppress PluginXmlValidity -->
<idea-plugin>
<depends optional="true">org.jetbrains.idea.maven</depends>
<extensions defaultExtensionNs="com.intellij">
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodIgnoredPortsForNotificationService" serviceImplementation="io.gitpod.jetbrains.remote.latest.GitpodIgnoredPortsForNotificationServiceImpl" preload="true"/>
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodCLIHelper" serviceImplementation="io.gitpod.jetbrains.remote.latest.GitpodCLIHelperImpl"/>
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodPortForwardingService" serviceImplementation="io.gitpod.jetbrains.remote.latest.GitpodPortForwardingServiceImpl" client="controller" preload="true"/>
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodClientProjectSessionTracker" client="controller" preload="true"/>
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodTerminalService" client="controller" preload="true"/>
<projectService serviceImplementation="io.gitpod.jetbrains.remote.maven.GitpodMavenProjectManager" client="controller" preload="true"/>
</extensions>
<actions>
<action id="io.gitpod.jetbrains.remote.latest.GitpodCopyUrlAction"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
-->
<!--suppress PluginXmlValidity -->
<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<projectService serviceImplementation="io.gitpod.jetbrains.remote.maven.GitpodMavenProjectManager" preload="true"/>
</extensions>
<applicationListeners>
<listener class="io.gitpod.jetbrains.remote.optional.GitpodMavenProjectManagerListener"
topic="com.intellij.openapi.project.ProjectManagerListener"/>
</applicationListeners>
</idea-plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<vendor>Gitpod</vendor>
<description>Provides integrations within a Gitpod workspace.</description>


<!-- Product and plugin compatibility requirements -->
<!-- https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
<depends>com.intellij.modules.platform</depends>
<depends optional="true" config-file="maven.xml">org.jetbrains.idea.maven</depends>
<dependencies>
<plugin id="Git4Idea"/>
<plugin id="org.jetbrains.plugins.terminal"/>
Expand Down

0 comments on commit ecb13e3

Please sign in to comment.