2

我正在尝试为Jahia网站开发模板集模块。

我使用了此处提供的官方文档中描述的分步过程:http ://www.jahia.com/cms/home/download/jahia-academy/documentation.default.html?displayTab=technical-documentation “模板和集成指南”。

基本上,它意味着使用 maven原型在服务器上初始化、构建和部署您的项目。前两个步骤已正确完成。它生成模块的骨架和强制文件。然后,我可以构建它来创建一个 .war 文件。

mvn archetype:generate -DarchetypeCatalog=http://maven.jahia.org/maven2    
>> [INFO] PROJECT GENERATED

mvn clean install
>> [INFO] BUILD SUCCESS

但是在部署过程中出现错误。

mvn jahia:deploy
>> [INFO] BUILD FAILURE
>> [ERROR] Failed to execute goal org.jahia.server:maven-jahia-plugin:2.81:deploy (default-cli) on project test-template-set: 
>> Error while validating deployers:Factory not initialized properly, 
>> you must set the targetServerDirectory variable before calling getInstance ! -> [Help 1]
>> [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

提供的链接给了我一个不言自明的结论:

与许多其他错误不同,此异常不是由 Maven 核心本身生成的,而是由插件生成的。异常的具体含义取决于插件,因此请查看其文档。

因此,在使用 Jahia 文档中描述的标准程序后,我能找到的唯一建议就是仔细查看它。欢迎来到生活的第 22 条规则。

我正在使用 Jahia6.6.1.0 社区分发。我在 Jahia 论坛中没有找到更多线索。

我想知道我错过了哪一步。这是一个常见的 Maven 错误吗?还是只是缺少 Jahia 强制文件?找到“helloworld 工作模块”的线索也很棒。

这是错误的完整跟踪:

[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Test Cooptation template set 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-jahia-plugin:2.81:deploy (default-cli) @ test-template-set ---
[INFO] Jahia project structure version is 2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.456s
[INFO] Finished at: Thu Apr 25 14:39:19 CEST 2013
[INFO] Final Memory: 12M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jahia.server:maven-jahia-plugin:2.81:deploy (default-cli) on project test-template-set: Error while validating deployers:
Factory not initialized properly, you must set the targetServerDirectory variabl
e before calling getInstance ! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jahia.server:maven-jahia-plugin:2.81:deploy (default-cli) on project test-template-set: Error while validating deployers
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        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:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error while validating deployers
        at org.jahia.utils.maven.plugin.DeployMojo.doValidate(DeployMojo.java:129)
        at org.jahia.utils.maven.plugin.AbstractManagementMojo.execute(AbstractManagementMojo.java:129)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: java.lang.RuntimeException: Factory not initialized properly, you must set the targetServerDirectory variable before calling getInstance !
        at org.jahia.configuration.deployers.ServerDeploymentFactory.getInstance(ServerDeploymentFactory.java:74)
        at org.jahia.utils.maven.plugin.DeployMojo.doValidate(DeployMojo.java:127)
        ... 22 more
[ERROR]
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
4

1 回答 1

4

先决条件 - Jahia提到我们至少应该调整到我们的 Apache Tomcat 应用程序服务器的目标路径,如果您将从源代码构建 Jahia 并部署它,数据库连接设置。

在 a 上settings.xml部署和使用的最小文件是:JahiaTomcatMySQL DBMS

<?xml version="1.0" encoding="ISO-8859-1"?>
<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:/development/m2repository</localRepository>

    <servers>
        <server>
            <id>jahiaRepository</id>
            <username>maven</username>
            <privateKey>C:/putty/maven.jahia.org.private</privateKey>
        </server>
    </servers>
    <profiles>
        <profile>
            <id>jahia-mysql</id>
            <properties>
                <jahia.configure.databaseType>mysql</jahia.configure.databaseType>
                <jahia.configure.databaseUrl>jdbc:mysql://localhost/jahia?useUnicode=true&amp;characterEncoding=UTF-8&amp;useServerPrepStmts=false</jahia.configure.databaseUrl>
                <jahia.configure.databaseUsername>root</jahia.configure.databaseUsername>
                <jahia.configure.databasePassword>password</jahia.configure.databasePassword>
            </properties>
        </profile>
        <profile>
            <id>jahia-tomcat</id>
            <properties>
                <jahia.deploy.targetServerType>tomcat</jahia.deploy.targetServerType>
                <jahia.deploy.targetServerDirectory>C:/development/apache-tomcat-6.0.32</jahia.deploy.targetServerDirectory>
                <jahia.deploy.targetServerVersion>6</jahia.deploy.targetServerVersion>
            </properties>
        </profile>
    </profiles>

    <activeProfiles>
        <activeProfile>jahia-mysql</activeProfile>
        <activeProfile>jahia-tomcat</activeProfile>
    </activeProfiles>

    <pluginGroups>
        <pluginGroup>org.jahia.server</pluginGroup>
    </pluginGroups>
</settings>

我希望这可能会有所帮助。

于 2013-04-26T08:44:57.900 回答