我按照本教程使用Alfresco Community 5.2构建自定义工作流程:
Creating Custom Advanced Workflows in Alfresco
示例项目的创建方式如下:
$ mvn archetype:generate -Dfilter=org.alfresco.maven.archetype:alfresco-platform-jar-archetype
然后我按照教程中的建议选择了正确的原型和3.0.0版本:
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
这会创建一个简单的项目,我应该可以使用以下命令运行它:
$ mvn clean install alfresco:run
但运行此命令会出错,因为某些存储库无法访问:
➜ 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
因此,这是尝试从存储库中提取一些需要身份验证的依赖项:
Downloading: https://artifacts.alfresco.com/nexus/content/groups/private/org/alfresco/maven/alfresco-sdk-aggregator/3.0.0-SNAPSHOT/maven-metadata.xml
它本身的错误是非常明显的,因为我无法访问私有的Nexus存储库,所以我没有得到一些依赖。但我想知道这是否总是这样,或者这是否是最近发生的变化,以及是否有人建议任何解决方法来构建项目。
答案 0 :(得分:0)
经过一些测试后,我找到了一个解决方法:将Alfresco Maven插件的版本从3.0.0更改为3.0.1,让我构建并运行示例应用程序。
所以,在pom.xml中查找:
<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>
将 $ {alfresco.sdk.version} 更改为 3.0.1 。你会有这个:
<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>
可能不是最好的解决方案,但似乎有效。