BrickTop
BrickTop

Reputation: 230

Cumulocity Maven repository error loading dependencies

I’m currently trying to develop new drivers for some Tinkerforge sensors which aren’t supported yet by Cumulocity. I’ve cloned the project https://bitbucket.org/m2m/cumulocity-examples and added a new Driver to the tinkerforge-driver project https://bitbucket.org/m2m/cumulocity-examples/src/c2b5da5b234510085804dcc947f682941ccbed20/java-agent/tinkerforge-driver/?at=default. When I try to build the project to create the jar I’m running into issues related to Maven dependencies:

[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

When running the build with the parameter –X, I see the following exceptions in the log:

[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

When I try to access the repository directly via http://resources.cumulocity.com/maven/repository/ I get a 403 Forbidden error.

I’ve update the maven settings.xml as specified here: 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>

Do I need to provide credentials for the Cumulocity Maven repo?

Upvotes: 1

Views: 419

Answers (2)

Georgi
Georgi

Reputation: 165

Yes, building the whole project is what you should do. We do not have the components of the project pre-build on our maven repository.

Upvotes: 1

Michael Welsing
Michael Welsing

Reputation: 19

for the repository issue: this is not a "browsable" webpage. Cumulocity has a guide how to configure the URL in Maven settings.xml or pom.xml file.

E.g see: http://cumulocity.com/guides/java/hello-world-basic/.

Hope that helps.

Best Regards Michael

Upvotes: 0

Related Questions