5

私はShareでいくつかのカスタマイズを開発して実行しています。私のIDEはEclipseJunoであり、ワークスペースは次の要素で構成されています。

  • 屋外ウェブプロジェクト
  • 拡張機能Javaプロジェクト
  • Webプロジェクトを共有する

屋外プロジェクトと共有Webプロジェクトの両方が別々のTomcatインスタンスにデプロイされます。このように、ShareがデプロイされているTomcatインスタンスのみを再起動することで、開発タスクをわずかにスピードアップできます。

私の拡張Javaプロジェクトは、Alfrescoによって提案されたEclipseプロジェクトと同じ構造を持っています。Y提供されたAntタスクは、JavaScriptファイルのコンパイル、圧縮、パッケージ化、および結果のJARファイルのTomcatへのデプロイを行います。

私はいくつかの新しいJavaScriptクライアント側ウィジェットを開発しています。つまり、変更を加えるたびに、Tomcatを停止し、Antビルドスクリプトを起動して再起動する必要があるため、頻繁に実行する必要があるため、それがどれほど苦痛かを推測できます。になりつつあります。Shareの開発タスクをスピードアップする方法があるかどうか疑問に思っていました。Alfresco開発者チームはどのようにそれを行いますか?彼らはどのような環境を整えていますか?

もちろんパスを考慮して、拡張プロジェクトのコンテンツをデプロイされたShareWebプロジェクトにホットデプロイする新しいAntターゲットを作成することを考えていました。ちなみに、そのメカニズムは逆の操作を可能にする必要があります。それは実行可能でしょうか?通常のWebプロジェクトを開発する場合と同様の展開メカニズムを使用するという考え方です。変更を加える場合は、[公開]ボタンを押すだけで、変更がサーバーに入力されます。

特に可能であればAlfresco開発者チームからのヒントやアイデアを知りたいです。

PS:私はすでにhttps://forums.alfresco.com/en/viewtopic.php?f=47&t=44850https://forums.alfresco.com/en/viewtopic.php?f=48&t=18749を読みました。

4

4 に答える 4

8

物事を大幅にスピードアップする2つのこと:

  • サーバーを再起動せずにクラスをリロードするためのjrebelライセンスに投資するhttp://zeroturnaround.com/software/jrebel/

  • Webスクリプトをターゲットフォルダーにコピーし、必要に応じてcurlを使用してWebスクリプトを再ロードするAntタスクを作成します。

Alfresco Share Webスクリプトをリロードするタスクの例:

<target name="deploy-share-webscripts" depends="Share: Copy files" description="Refreshes the list of webscripts">
    <exec executable="curl">
    <arg value="-d"/>
    <arg value="reset=on"/>
    <arg value="http://admin:admin@${share.web.url}/page/console?reset=webscripts"/>
    </exec>
</target>

antタスクのコピー部分を追加します(src-dirsはビルドファイルの先頭でプロパティとして宣言されています):

    <echo message="- Copying java classes" />
    <copy todir="${warWebappTargetClasses}" overwrite="false" verbose="true">
        <fileset dir="${warTargetJavaDir}" />
    </copy>

    <echo message="- Copying resource files" />
    <copy todir="${warWebappTargetClasses}" overwrite="false" verbose="true">
        <fileset dir="${warSrcResourcesDir}" >
            <include name="**/model/*"/>
            <include name="**/templates/**/*"/>
            <include name="**/custom-model-context.xml"/>
            <include name="**/web-client-config-custom.xml"/>
            <include name="**/webclient.properties"/>
            <include name="**/aka-model-resourcebundle*"/>
            <include name="log4j.properties"/>
        </fileset>
    </copy>

    <echo message="- Copying resource files from amp into war for quick deployment." />
    <copy todir="${warWebappTargetClasses}" overwrite="false" verbose="true">
        <fileset dir="${projectAmpResourcesSrcDir}" />
        <fileset dir="${projectAmpClassesDir}" />

        <fileset dir="${listmanagerAmpResourcesSrcDir}" />

    </copy>

    <echo message="- Copying config files from amp into war for quick deployment." />
    <copy todir="${warWebappTargetClasses}\alfresco\module\Project-amp\" overwrite="false" verbose="true">

        <fileset dir="${projectAmpConfigSrcDir}" />


    </copy>
</target>

セットアップにはMavenの屋外ライフサイクルhttp://wiki.alfresco.com/wiki/Managing_Alfresco_Lifecyle_with_Mavenを使用します。これにより、処理も高速化されます。このトピックにはたくさんのことが追加できると思います。

于 2013-01-11T15:30:36.530 に答える
3

tomcats共有クラスローダーの追加パスを構成することにより、Webスクリプトをtomcatにコピーすることを回避できます。これはの設定ですtomcat/conf/catalina.properties。これをプロジェクトのソースディレクトリに直接設定したので、コンパイル手順は必要ありません。

shared.loader=${catalina.home}/shared/classes,${catalina.home}/shared/lib/*.jar,\
/path/to/my/dashlet/src/main/resources,\

shared/classes/alfresco/web-extension/share-config-custom.xmlテンプレートとウェブスクリプトの自動更新を有効にするために、次の設定もあります。

<alfresco-config>
    <!-- Global config section -->
    <config replace="true">
        <flags>
            <!-- Developer debugging setting - DEBUG mode for client scripts in the browser -->
            <client-debug>true</client-debug>

            <!-- LOGGING can be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift).
                 This flag automatically activates logging on page load. -->
            <client-debug-autologging>false</client-debug-autologging>
        </flags>
    </config>

    <config evaluator="string-compare" condition="WebFramework">
        <web-framework>
            <!-- Autowire Runtime Settings -->
            <autowire>
                <!--
                    Developers can set mode to 'production' or 'development' (to disable; SpringSurf caches,
                    FreeMarker template caching and Rhino JavaScript compilation.)
                -->
                <mode>development</mode>
            </autowire>
        </web-framework>
    </config>
</alfresco-config>
于 2013-01-11T16:12:24.160 に答える
2

さて、これは私が期待したように100%機能しているソリューションです。@erik-bと@jorn-horstmannの回答の後で、私が読んだいくつかの投稿を考慮して、これを思いついた。

つまり、基本的に、Share拡張機能のJavaプロジェクトのコンテンツをホットデプロイする次のAntターゲットがあります。

<!--
    Hot copy individual files into appropriate deployment folder (e.g. $TOMCAT_HOME/webapps/share)
-->
<target name="hotdeploy-tomcat-share" depends="clean, prepare, build-jar" description="Hot copy individual files into appropriate deployment folder (e.g. $TOMCAT_HOME/webapps/share)">
    <echo message="Generating and deploying JAR file with custom configuration files" />
    <jar destfile="${dist.dir}/${jar.name}">
        <!-- Only including configuration XML files such as share-config-custom.xml -->
        <fileset dir="${build.jar.dir}" includes="**/META-INF/*.xml" />
    </jar>
    <copy todir="${tomcat.share.deployment.path}/WEB-INF/lib">
        <fileset file="${dist.dir}/${jar.name}" />
    </copy>

    <echo message="Hot deploying Share files" />
    <copy todir="${tomcat.share.deployment.path}/WEB-INF/classes" includeEmptyDirs="false">
        <fileset dir="${build.jar.dir}">
            <patternset refid="hotdeploy-tomcat-patternset" />
        </fileset>
    </copy>
</target>

モジュールの自動再読み込み機能を無効にする必要があります。無効にしないと、上記のAntターゲットを実行するたびにTomcatがShareおよびデプロイされた他のWebアプリを再読み込みします。さらに、$ TOMCAT_HOME / shared /ディレクトリにホットデプロイすることも可能だと思いますが、まだ試していません。

拡張機能の開発に使用しているJavaプロジェクトは、次のモデルプロジェクトです:http ://code.google.com/p/share-extras/wiki/SampleProject 。必要な他のターゲットを含む完全なビルドスクリプトがあります。

私はshare-config-custom.xmlでもこれを使用しています:

   <!-- Global config section -->
   <config replace="true">
      <flags>
         <!--
            Developer debugging setting to turn on DEBUG mode for client scripts in the browser
         -->
         <client-debug>true</client-debug>

         <!--
            LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift).
            This flag automatically activates logging on page load.
         -->
         <client-debug-autologging>false</client-debug-autologging>
      </flags>
   </config>

   <config evaluator="string-compare" condition="WebFramework">
      <web-framework>
         <!-- SpringSurf Autowire Runtime Settings -->
         <!-- 
              Developers can set mode to 'development' to disable; SpringSurf caches,
              FreeMarker template caching and Rhino JavaScript compilation.
         -->
         <autowire>
            <!-- Pick the mode: "production" or "development" -->
            <mode>development</mode>
         </autowire>

         <!-- Allows extension modules with <auto-deploy> set to true to be automatically deployed -->
         <module-deployment>
            <mode>manual</mode>
            <enable-auto-deploy-modules>true</enable-auto-deploy-modules>
         </module-deployment>
      </web-framework>
   </config>

最後のXMLスニペットは、たとえばFTLページで変更が実行された後にWebスクリプトを更新することを回避します。

また、JRebelを使用していくつかのテストを実行しましたが、経験を積んだ後は、Shareの開発にはあまり役立たないと思います。

次の記事にも興味深いものがあります:

http://blogs.alfresco.com/wp/kevinr/2010/04/07/developer-tips-for-alfresco-share-33/

http://techblog.zabuchy.net/2012/debugging-javascript-in-alfresco/

それが他の人に役立つことを願っています。

于 2013-01-18T08:31:03.497 に答える
1

私は通常、プライベートインスタンスで作業しているので、展開されたアプリを実行する余裕があり、変更があればすぐに表示されます。データモデルを変更したり、新しいJavaベースのモジュールやWebスクリプトなどをデプロイしたりする場合にのみ、Tomcatを再起動する必要があります。それらのいくつかはライブでリロードすることもできますが。

于 2013-12-09T14:35:04.297 に答える