我目前正在尝试为Cumulocity尚未支持的一些Tinkerforge传感器开发新的驱动程序。我克隆了项目https://bitbucket.org/m2m/cumulocity-examples,并在tinkerforge-driver项目https://bitbucket.org/m2m/cumulocity-examples/src/c2b5da5b234510085804dcc947f682941ccbed20/java-agent/tinkerforge-driver/?at=default中添加了一个新的驱动程序。当我尝试构建项目来创建jar时,我遇到了与Maven依赖关系相关的问题:
[ERROR] Failed to execute goal on project tinkerforge-driver: Could not resolve dependencies for project c8y.example:tinkerforge-driver:jar:8.14.0: The following artifacts could not be resolved: c8y.example:jv-driver:jar:8.14.0, c8y.example:jv-agent-assembly:tar.gz:tar:8.14.0: Could not find artifact c8y.example:jv-driver:jar:8.14.0 in cumulocity-maven-repo (http://resources.cumulocity.com/maven/repository) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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
使用参数-X运行构建时,我在日志中看到以下异常:
[ERROR] Failed to execute goal on project tinkerforge-driver: Could not resolve dependencies for project c8y.example:tinkerforge-driver:jar:8.14.0: The following artifacts could not be resolved: c8y.example:jv-driver:jar:8.14.0, c8y.example:jv-agent-assembly:tar.gz:tar:8.14.0: Could not find artifact c8y.example:jv-driver:jar:8.14.0 in cumulocity-maven-repo (http://resources.cumulocity.com/maven/repository) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project tinkerforge-driver: Could not resolve dependencies for project c8y.example:tinkerforge-driver:jar:8.14.0: The following artifacts could not be resolved: c8y.example:jv-driver:jar:8.14.0, c8y.example:jv-agent-assembly:tar.gz:tar:8.14.0: Could not find artifact c8y.example:jv-driver:jar:8.14.0 in cumulocity-maven-repo (http://resources.cumulocity.com/maven/repository)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:245)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.project.DependencyResolutionException: Could not resolve dependencies for project c8y.example:tinkerforge-driver:jar:8.14.0: The following artifacts could not be resolved: c8y.example:jv-driver:jar:8.14.0, c8y.example:jv-agent-assembly:tar.gz:tar:8.14.0: Could not find artifact c8y.example:jv-driver:jar:8.14.0 in cumulocity-maven-repo (http://resources.cumulocity.com/maven/repository)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:211)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
... 23 more
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: c8y.example:jv-driver:jar:8.14.0, c8y.example:jv-agent-assembly:tar.gz:tar:8.14.0: Could not find artifact c8y.example:jv-driver:jar:8.14.0 in cumulocity-maven-repo (http://resources.cumulocity.com/maven/repository)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:384)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:205)
... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: c8y.example:jv-driver:jar:8.14.0, c8y.example:jv-agent-assembly:tar.gz:tar:8.14.0: Could not find artifact c8y.example:jv-driver:jar:8.14.0 in cumulocity-maven-repo (http://resources.cumulocity.com/maven/repository)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
... 25 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact c8y.example:jv-driver:jar:8.14.0 in cumulocity-maven-repo (http://resources.cumulocity.com/maven/repository)
at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:893)
at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:1)
at io.takari.aether.connector.AetherRepositoryConnector$GetTask.flush(AetherRepositoryConnector.java:673)
at io.takari.aether.connector.AetherRepositoryConnector.get(AetherRepositoryConnector.java:310)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
... 27 more
当我尝试通过http://resources.cumulocity.com/maven/repository/直接访问存储库时,我收到403 Forbidden错误。
我按照此处的指定更新了maven settings.xml:https://bitbucket.org/m2m/cumulocity-examples
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:/dev/.m2</localRepository>
<activeProfiles>
<activeProfile>cumulocity</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>cumulocity</id>
<repositories>
<repository>
<id>cumulocity-maven-repo</id>
<url>http://resources.cumulocity.com/maven/repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>cumulocity-plugins-repo</id>
<url>http://resources.cumulocity.com/maven/repository</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
我是否需要为Cumulocity Maven回购提供凭证?
答案 0 :(得分:1)
是的,构建整个项目是你应该做的。我们没有在maven存储库上预构建项目的组件。
答案 1 :(得分:0)
存储库问题:这不是&#34;可浏览&#34;网页。 Quumulocity提供了如何在Maven settings.xml或pom.xml文件中配置URL的指南。
请参阅:http://cumulocity.com/guides/java/hello-world-basic/。
希望有所帮助。
最诚挚的问候 迈克尔