03-20-2018 08:57 AM
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-...
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/org/alfresco/maven/plugin/alfre...
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public/org/alfresco/maven/plugin/alfresco-maven-...
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/org/alfresco/maven/plugin/alfre...
[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-SNA...
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/org/alfresco/maven/alfresco-rad...
Downloading: https://artifacts.alfresco.com/nexus/content/groups/private/org/alfresco/maven/alfresco-rad/3.0.0-SN...
[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-aggregato...
Downloading: https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/org/alfresco/maven/alfresco-sdk...
Downloading: https://artifacts.alfresco.com/nexus/content/groups/private/org/alfresco/maven/alfresco-sdk-aggregat...
[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-aggregat...
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?
03-23-2018 07:35 AM
Thank you, I don't know what exactly is going on with the original repo used in the tutorial, but after some more tests, I've found a workaround: changing the version of the Alfresco Maven Plugin from 3.0.0 to 3.0.1 let me build and run the sample application.
So, in the pom.xml I've got this section:
<build> <plugins> <!-- The Alfresco Maven Plugin contains all the logic to run the extension in an embedded Tomcat with the H2 database. --> <plugin> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>alfresco-maven-plugin</artifactId> <version>${alfresco.sdk.version}</version> <executions> <execution> <id>start-alfresco</id> <goals> <goal>it</goal> </goals> <phase>pre-integration-test</phase> </execution> </executions> <configuration>
And changed ${alfresco.sdk.version} to 3.0.1, like this:
<build> <plugins> <!-- The Alfresco Maven Plugin contains all the logic to run the extension in an embedded Tomcat with the H2 database. --> <plugin> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>alfresco-maven-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <id>start-alfresco</id> <goals> <goal>it</goal> </goals> <phase>pre-integration-test</phase> </execution> </executions> <configuration>
Probably not the best solution, but seems to be working.
03-21-2018 01:03 AM
Either there is corrupted dependency in the .m2 folder for this http uri Or else you have some issue with network where it is blocking this dependencies to be downloaded in the system
First try to delete dependencies from .m2 folder only those jar for which you are getting the error.If not getting resolve, change the network.
03-23-2018 07:35 AM
Thank you, I don't know what exactly is going on with the original repo used in the tutorial, but after some more tests, I've found a workaround: changing the version of the Alfresco Maven Plugin from 3.0.0 to 3.0.1 let me build and run the sample application.
So, in the pom.xml I've got this section:
<build> <plugins> <!-- The Alfresco Maven Plugin contains all the logic to run the extension in an embedded Tomcat with the H2 database. --> <plugin> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>alfresco-maven-plugin</artifactId> <version>${alfresco.sdk.version}</version> <executions> <execution> <id>start-alfresco</id> <goals> <goal>it</goal> </goals> <phase>pre-integration-test</phase> </execution> </executions> <configuration>
And changed ${alfresco.sdk.version} to 3.0.1, like this:
<build> <plugins> <!-- The Alfresco Maven Plugin contains all the logic to run the extension in an embedded Tomcat with the H2 database. --> <plugin> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>alfresco-maven-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <id>start-alfresco</id> <goals> <goal>it</goal> </goals> <phase>pre-integration-test</phase> </execution> </executions> <configuration>
Probably not the best solution, but seems to be working.
Explore our Alfresco products with the links below. Use labels to filter content by product module.