这是我的pom.xml
<project ... >
<modelVersion>4.0.0</modelVersion>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-alexa</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- lambda -->
<lambda.functionCode>${project.build.directory}/${project.build.finalName}.jar</lambda.functionCode>
<lambda.version>${project.version}</lambda.version>
<lambda.publish>true</lambda.publish>
<lambda.forceUpdate>true</lambda.forceUpdate>
<!-- versions -->
<alexa-skills-kit.version>1.3.1</alexa-skills-kit.version>
<junit.version>4.12</junit.version>
<kubernetes-client.version>2.5.1</kubernetes-client.version>
<sundrio.version>0.8.2</sundrio.version>
<!-- plugin versions -->
<lambda-maven-plugin.version>2.2.2</lambda-maven-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- We are importing the kuberntes-client bom with deps to prevent jackson conflicts -->
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
<version>${kubernetes-client.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>openshift-client</artifactId>
<version>${kubernetes-client.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazon.alexa/alexa-skills-kit -->
“ pom.xml” 148L,5831C
部署命令:
mvn clean package shade:shade com.github.seanroy:lambda-maven-plugin:deploy-lambda
部署Maven时出错:
日志:
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.sun:tools:jar:1.7 at specified path /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/../lib/tools.jar
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:264)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:224)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies (DefaultRepositorySystem.java:338)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve (DefaultProjectDependenciesResolver.java:202)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:243)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:147)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:246)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:200)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:564)
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)
[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/DependencyResolutionException
**Error :** Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.sun:tools:jar:1.7 at specified path
注意:在MacOS上运行
答案 0 :(得分:3)
简短答案:
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>3.1.8</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
</exclusion>
</exclusions>
</dependency>
-
长版本。
为了跟踪链接到tools.jar的伪像,我使用mvn dependency:tree
来显示dependency:tree,因此您可以找到应该包含哪些artifactId的排除项。
注意,这可能会有副作用,必须进行测试。
希望获得帮助
就我而言:
$ mvn dependency:tree | grep -B 10 -A 1 tools.jar
[INFO] +- io.fabric8:kubernetes-server-mock:jar:3.1.8:test
[INFO] | \- io.fabric8:mockwebserver:jar:0.1.0:test
[INFO] | +- com.squareup.okhttp3:mockwebserver:jar:3.9.0:test
[INFO] | | \- org.bouncycastle:bcprov-jdk15on:jar:1.50:test
[INFO] | \- io.sundr:builder-annotations:jar:0.2.7:test
[INFO] | +- io.sundr:sundr-core:jar:0.2.7:test
[INFO] | +- io.sundr:sundr-codegen:jar:0.2.7:test
[INFO] | | \- org.apache.velocity:velocity:jar:1.7:test
[INFO] | | +- commons-collections:commons-collections:jar:3.2.1:test
[INFO] | | \- commons-lang:commons-lang:jar:2.4:test
[INFO] | \- com.sun:tools:jar:1.7:system
[INFO] +- org.apache.commons:commons-lang3:jar:3.4:compile
所以我将pom.xml设置为:
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-server-mock</artifactId>
<version>3.1.8</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
</exclusion>
</exclusions>
</dependency>