"Обнаружены проблемы с зависимостями", когда `mvn clean install` проект че плагина - PullRequest
0 голосов
/ 10 июля 2019

Я скачал пример проекта плагина che che-ide-server-extension . Это работает, когда mvn clean install. Но когда я добавляю зависимость в

che-ide-server-extension/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml

, не удается установить.

Зависимость, которую я добавил,

<dependency>
    <groupId>org.eclipse.che.core</groupId>
    <artifactId>che-core-ide-ui</artifactId>
</dependency>

А сообщение об ошибке mvn clean install -e -X:

...
[WARNING] Unused declared dependencies found:
[WARNING]    org.eclipse.che.core:che-core-ide-ui:jar:6.16.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Plugin ServerService :: Parent pom ................. SUCCESS [  2.174 s]
[INFO] Plugin ServerService :: Plugins ::  Parent ......... SUCCESS [  0.064 s]
[INFO] Plugin ServerService :: Plugin :: Parent ........... SUCCESS [  1.382 s]
[INFO] Plugin ServerService :: Plugin :: Server ........... SUCCESS [  3.827 s]
[INFO] Plugin ServerService :: Plugin :: IDE .............. FAILURE [  4.870 s]
[INFO] Plugin ServerService :: Che Assembly :: Assembly Parent SKIPPED
[INFO] Plugin ServerService :: Che Assembly :: Workspace Agent Assembly SKIPPED
[INFO] Plugin ServerService :: Che Assembly :: Workspace Agent Tomcat Assembly SKIPPED
[INFO] Plugin ServerService :: Che Assembly :: IDE Assembly SKIPPED
[INFO] Plugin ServerService :: Che Assembly :: Assemblies Tomcat SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.925 s
[INFO] Finished at: 2019-07-10T10:48:43+08:00
[INFO] Final Memory: 75M/1321M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.0.1:analyze-only (analyze) on project plugin-serverservice-ide: Dependency problems found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.0.1:analyze-only (analyze) on project plugin-serverservice-ide: Dependency problems found
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Dependency problems found
    at org.apache.maven.plugins.dependency.analyze.AbstractAnalyzeMojo.execute(AbstractAnalyzeMojo.java:261)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :plugin-serverservice-ide

Не думаю, что я добавил неправильную зависимость. Потому что когда я

import org.eclipse.che.ide.ui.dialogs.DialogFactory;

в моем коде java, че говорит

The import org.eclipse.che.ide.ui.dialogs cannot be resolved.

Но после того, как я добавил зависимость, че может ее распознать.

Я не знаю, почему это происходит ... В сообщении об ошибке написано Dependency problems found, но это не указывало на реальную проблему ...

1 Ответ

0 голосов
/ 10 июля 2019

Я только что проверил, и у меня не было проблем, о которых вы упоминали выше.Это мои изменения для проекта:

diff --git a/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml b/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml
index 1237c6e..a5eed89 100644
--- a/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml
+++ b/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml
@@ -28,6 +28,10 @@
             <groupId>javax.inject</groupId>
             <artifactId>javax.inject</artifactId>
         </dependency>
+<dependency>
+    <groupId>org.eclipse.che.core</groupId>
+    <artifactId>che-core-ide-ui</artifactId>
+</dependency>
         <dependency>
             <groupId>org.eclipse.che.core</groupId>
             <artifactId>che-core-commons-gwt</artifactId>
diff --git a/plugins/plugin-serverservice/plugin-serverservice-ide/src/main/java/org/eclipse/che/sample/ide/MyServiceClient.java b/plugins/plugin-serverservice/plugin-serverservice-ide/src/main/java/org/eclipse/che/sample/ide/MyServiceClient.java
index cb1cf58..0def9c2 100644
--- a/plugins/plugin-serverservice/plugin-serverservice-ide/src/main/java/org/eclipse/che/sample/ide/MyServiceClient.java
+++ b/plugins/plugin-serverservice/plugin-serverservice-ide/src/main/java/org/eclipse/che/sample/ide/MyServiceClient.java
@@ -8,13 +8,15 @@
  */
 package org.eclipse.che.sample.ide;

-import javax.inject.Inject;
 import org.eclipse.che.api.promises.client.Promise;
 import org.eclipse.che.ide.api.app.AppContext;
 import org.eclipse.che.ide.rest.AsyncRequestFactory;
 import org.eclipse.che.ide.rest.StringUnmarshaller;
+import org.eclipse.che.ide.ui.dialogs.DialogFactory;
 import org.eclipse.che.ide.ui.loaders.request.LoaderFactory;

+import javax.inject.Inject;
+
 /**
  * Client for consuming the sample server service.
  *
@@ -25,6 +27,7 @@ public class MyServiceClient {
   private AppContext appContext;
   private AsyncRequestFactory asyncRequestFactory;
   private LoaderFactory loaderFactory;
+  private DialogFactory dialogFactory;

   /**
    * Constructor.
@@ -38,8 +41,10 @@ public class MyServiceClient {
   public MyServiceClient(
       final AppContext appContext,
       final AsyncRequestFactory asyncRequestFactory,
-      final LoaderFactory loaderFactory) {
+      final LoaderFactory loaderFactory,
+      final DialogFactory dialogFactory) {

+    this.dialogFactory = dialogFactory;
     this.appContext = appContext;
     this.asyncRequestFactory = asyncRequestFactory;
     this.loaderFactory = loaderFactory;
@@ -52,6 +57,7 @@ public class MyServiceClient {
    * @return a Promise containing the server response
    */
   public Promise<String> getHello(String name) {
+    this.dialogFactory.createChoiceDialog("1", "2", "", "", null, null);
     return asyncRequestFactory
         .createGetRequest(appContext.getWsAgentServerApiEndpoint() + "/hello/" + name)
         .loader(loaderFactory.newLoader("Waiting for hello..."))
...