From 7c7f8c16569590a2c376d059e3ffdffafbae327d Mon Sep 17 00:00:00 2001 From: Anton Kosyakov Date: Mon, 14 Nov 2022 12:03:53 +0200 Subject: [PATCH] [jetbrains]: force initialize maven project to work around initialization after warmup in prebuilds Co-authored-by: Victor Nogueira --- .../backend-plugin/gradle.properties | 2 +- .../GitpodForceUpdateMavenProjectsActivity.kt | 22 +++++++++++++++++++ .../src/main/resources/META-INF/maven.xml | 10 +++++++++ .../src/main/resources/META-INF/plugin.xml | 2 +- 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/optional/GitpodForceUpdateMavenProjectsActivity.kt create mode 100644 components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/maven.xml diff --git a/components/ide/jetbrains/backend-plugin/gradle.properties b/components/ide/jetbrains/backend-plugin/gradle.properties index 42f3ce9adef124..292837c5a96ccb 100644 --- a/components/ide/jetbrains/backend-plugin/gradle.properties +++ b/components/ide/jetbrains/backend-plugin/gradle.properties @@ -10,7 +10,7 @@ platformType=IU platformDownloadSources=true # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 -platformPlugins=Git4Idea, org.jetbrains.plugins.terminal, com.jetbrains.codeWithMe +platformPlugins=Git4Idea, org.jetbrains.plugins.terminal, com.jetbrains.codeWithMe, org.jetbrains.idea.maven # Opt-out flag for bundling Kotlin standard library. # See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details. kotlin.stdlib.default.dependency=false diff --git a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/optional/GitpodForceUpdateMavenProjectsActivity.kt b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/optional/GitpodForceUpdateMavenProjectsActivity.kt new file mode 100644 index 00000000000000..c9b4dd6e294776 --- /dev/null +++ b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/optional/GitpodForceUpdateMavenProjectsActivity.kt @@ -0,0 +1,22 @@ +// Copyright (c) 2022 Gitpod GmbH. All rights reserved. +// 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.optional + +import com.intellij.openapi.diagnostic.thisLogger +import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.StartupActivity +import org.jetbrains.idea.maven.project.MavenProjectsManager + +class GitpodForceUpdateMavenProjectsActivity : StartupActivity.RequiredForSmartMode { + override fun runActivity(project: Project) { + val mavenProjectManager = MavenProjectsManager.getInstance(project) + + if (!mavenProjectManager.isMavenizedProject) return + + mavenProjectManager.forceUpdateAllProjectsOrFindAllAvailablePomFiles() + + thisLogger().warn("gitpod: Forced the update of Maven Project.") + } +} diff --git a/components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/maven.xml b/components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/maven.xml new file mode 100644 index 00000000000000..ec8193ecec1cb9 --- /dev/null +++ b/components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/maven.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/plugin.xml b/components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/plugin.xml index 5c3f2c6a3e8476..896fdeefbb5e4f 100644 --- a/components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/plugin.xml +++ b/components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/plugin.xml @@ -12,10 +12,10 @@ Gitpod Provides integrations within a Gitpod workspace. - com.intellij.modules.platform + org.jetbrains.idea.maven