“ mvn clean install” che插件项目时“找到依赖项问题”

时间:2019-07-10 03:10:26

标签: maven eclipse-che

我下载了che插件项目示例che-ide-server-extensionmvn 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代码中,che说

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

但是在添加依赖项之后,che可以识别它。

我不知道为什么会这样...错误消息显示Dependency problems found,但它并未指出真正的问题...

1 个答案:

答案 0 :(得分:0)

我刚刚检查了一下,但没有遇到您上面提到的任何问题。 这是我对项目的更改:

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..."))