AnsweredAssumed Answered

Error with Alfresco SDK 3.0.0 and Maven

Question asked by uilian on Mar 20, 2018
Latest reply on Mar 23, 2018 by uilian

I'm following this tutorial to build custom workflows with Alfresco Community 5.2:

 

Creating Custom Advanced Workflows in Alfresco

 

The sample project is created like this:

 

$ mvn archetype:generate -Dfilter=org.alfresco.maven.archetype:alfresco-platform-jar-archetype

 

Then I've selected the correct archetype and the version 3.0.0, as recommended in the tutorial:

Choose archetype:
1: remote -> org.alfresco.maven.archetype:alfresco-platform-jar-archetype (Sample project with full support for lifecycle and rapid development of Platform/Repository JARs and AMPs (Alfresco Module Packages))
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Choose org.alfresco.maven.archetype:alfresco-platform-jar-archetype version:
1: 3.0.0
2: 3.0.1
Choose a number: : 1

This creates a simple project, which I should be able to run with the following command:

 

$ mvn clean install alfresco:run

 

But running this gives an error because some repositories are unreachable:

➜ mvn clean install alfresco:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building poc-hmv Platform Jar Module - SDK 3 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public/org/alfresco/maven/plugin/alfresco-maven-plugin/3.0.0-SNAPSHOT/maven-metadata.xml
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/org/alfresco/maven/plugin/alfresco-maven-plugin/3.0.0-SNAPSHOT/maven-metadata.xml
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public/org/alfresco/maven/plugin/alfresco-maven-plugin/3.0.0-SNAPSHOT/alfresco-maven-plugin-3.0.0-SNAPSHOT.pom
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/org/alfresco/maven/plugin/alfresco-maven-plugin/3.0.0-SNAPSHOT/alfresco-maven-plugin-3.0.0-SNAPSHOT.pom
[WARNING] The POM for org.alfresco.maven.plugin:alfresco-maven-plugin:jar:3.0.0-SNAPSHOT is missing, no dependency information available
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public/org/alfresco/maven/alfresco-rad/3.0.0-SNAPSHOT/maven-metadata.xml
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/org/alfresco/maven/alfresco-rad/3.0.0-SNAPSHOT/maven-metadata.xml
Downloading: https://artifacts.alfresco.com/nexus/content/groups/private/org/alfresco/maven/alfresco-rad/3.0.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.alfresco.maven:alfresco-rad:3.0.0-SNAPSHOT/maven-metadata.xml from/to alfresco-private-repository (https://artifacts.alfresco.com/nexus/content/groups/private): Not authorized , ReasonPhrase:Unauthorized.
[WARNING] Failure to transfer org.alfresco.maven:alfresco-rad:3.0.0-SNAPSHOT/maven-metadata.xml from https://artifacts.alfresco.com/nexus/content/groups/private was cached in the local repository, resolution will not be reattempted until the update interval of alfresco-private-repository has elapsed or updates are forced. Original error: Could not transfer metadata org.alfresco.maven:alfresco-rad:3.0.0-SNAPSHOT/maven-metadata.xml from/to alfresco-private-repository (https://artifacts.alfresco.com/nexus/content/groups/private): Not authorized , ReasonPhrase:Unauthorized.
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public/org/alfresco/maven/alfresco-sdk-aggregator/3.0.0-SNAPSHOT/maven-metadata.xml
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/org/alfresco/maven/alfresco-sdk-aggregator/3.0.0-SNAPSHOT/maven-metadata.xml
Downloading: https://artifacts.alfresco.com/nexus/content/groups/private/org/alfresco/maven/alfresco-sdk-aggregator/3.0.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.alfresco.maven:alfresco-sdk-aggregator:3.0.0-SNAPSHOT/maven-metadata.xml from/to alfresco-private-repository (https://artifacts.alfresco.com/nexus/content/groups/private): Not authorized , ReasonPhrase:Unauthorized.
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ poc-hmv ---
[INFO] Deleting /home/uilian/projects/poc-alfresco-hmv/poc-hmv/target
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ poc-hmv ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 14 resources
[INFO]
[INFO] --- jrebel-maven-plugin:1.1.6:generate (generate-rebel-xml) @ poc-hmv ---
[INFO] Processing br.com.softdesign:poc-hmv with packaging jar
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ poc-hmv ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/uilian/projects/poc-alfresco-hmv/poc-hmv/target/classes
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ poc-hmv ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ poc-hmv ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ poc-hmv ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ poc-hmv ---
[INFO] Building jar: /home/uilian/projects/poc-alfresco-hmv/poc-hmv/target/poc-hmv-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- alfresco-maven-plugin:3.0.0-SNAPSHOT:it (start-alfresco) @ poc-hmv ---
[WARNING] The POM for org.alfresco.maven.plugin:alfresco-maven-plugin:jar:3.0.0-SNAPSHOT is missing, no dependency information available
[WARNING] Error injecting: org.alfresco.maven.plugin.IntegrationTestMojo
java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getDeclaredConstructors(Class.java:2020)
at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:658)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:1006)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1038)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:65)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:517)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
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: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 55 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.672 s
[INFO] Finished at: 2018-03-20T08:47:35-03:00
[INFO] Final Memory: 45M/231M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.alfresco.maven.plugin:alfresco-maven-plugin:3.0.0-SNAPSHOT:it (start-alfresco) on project poc-hmv: Execution start-alfresco of goal org.alfresco.maven.plugin:alfresco-maven-plugin:3.0.0-SNAPSHOT:it failed: A required class was missing while executing org.alfresco.maven.plugin:alfresco-maven-plugin:3.0.0-SNAPSHOT:it: org/apache/http/client/methods/HttpUriRequest
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.alfresco.maven.plugin:alfresco-maven-plugin:3.0.0-SNAPSHOT
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/uilian/.m2/repository/org/alfresco/maven/plugin/alfresco-maven-plugin/3.0.0-SNAPSHOT/alfresco-maven-plugin-3.0.0-SNAPSHOT.jar
[ERROR] urls[1] = file:/home/uilian/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.apache.http.client.methods.HttpUriRequest
[ERROR] -> [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/PluginContainerException

So, this is trying to pull some dependencies from repository which requires authentication:

Downloading: https://artifacts.alfresco.com/nexus/content/groups/private/org/alfresco/maven/alfresco-sdk-aggregator/3.0.0-SNAPSHOT/maven-metadata.xml

Should this be happening? Since Alfresco is an opensource project, shouldn't be possible to me to use it's SDK? I think the tutorial would mention if enterprise features were included. Anyone had the same experience?

Outcomes