如何在Hybris商务服务器上启动node服务器?

问题描述 投票:0回答:3

SAP Commerce 1905

我有一个node应用程序,我想把它整合到我的Hybris中。我已经创建了一个自定义的addon,并把我的node应用文件放在addon扩展中。现在我想在Hybris服务器上运行以下命令。

nohup npm start > output.log&

我可以在蚂蚁建站时,将npm命令放在以下位置来启动我的node服务器。myextension_compileuisrc_executor(执行器) buildcallback。

但我的目标是只在下面执行npm安装。myextension_compileuisrc_executor(执行器) 而不是node服务器启动。

这就是为什么我在Hybris Server Start上寻找启动node.js服务器的方法。我找不到任何目标在buildcallback中,我可以注入我的服务器启动命令。

如何实现呢?

更新。

尝试用 myextension_before_startHybrisServer. 也是,但没有运气

<macrodef name="myextension_before_startHybrisServer">

    <sequential>

        <npm-start/>

    </sequential>

</macrodef>
node.js hybris
3个回答
0
投票

嗨,我试图写正常的宏

    <sequential>
        <echo message="JJJJJJ RAUSHAN JAAAA" />

    </sequential>

</macrodef>

output:
 [echo] JJJJJJ RAUSHAN JAAAA
     [echo] Checking lock flag for the platform
     [exec] --> Wrapper Started as Console
     [exec] Java Service Wrapper Professional Edition 64-bit 3.5.29

命令:>蚂蚁启动HybrisServer。


0
投票

你好,请尝试在build-callbacks中写自定义微。

<macrodef name="xxxstorefront_getnpm">
 <sequential>


        <echo message="Checking for NPM" />

        <if>
            <os family="windows" />
            <then>
                <exec dir="${platformhome}" executable="cmd.exe" osfamily="windows">
                    <arg line="/c" />
                    <arg line="npm.bat" />
                </exec>
            </then>
            <else>
                <exec dir="${platformhome}" executable="sh" osfamily="unix">
                    <arg line="-c ./npm.sh" />
                </exec>
            </else>
        </if>


    </sequential>
</macrodef>

然后像这样添加这个回调的引用。

<macrodef name="xxxstorefront_compileuisrc_executor">
    <sequential>
        <xxxstorefront_getnpm/>

    </sequential>
</macrodef>

0
投票

有一个变通的方法,你可以试试。

请建立一个文件夹,像这样 \hybris/config/customize/platform/resourcesantplatformadministration.xml。

并复制现有的platformadministration.xml并创建自己的微观定义,然后创建文件\hybris\config\customize\platformbuild.xml。

<macrodef name="xxxstorefront_getnpm">

    <echo message="Checking for NPM" />

    <if>
        <os family="windows" />
        <then>
            <exec dir="${platformhome}" executable="cmd.exe" osfamily="windows">
                <arg line="/c" />
                <arg line="npm.bat" />
            </exec>
        </then>
        <else>
            <exec dir="${platformhome}" executable="sh" osfamily="unix">
                <arg line="-c ./npm.sh" />
            </exec>
        </else>
    </if>


</sequential>

然后创建文件 hybris/config/customize/platform/build.xml。

并在上面的build.xml中添加新创建的微定义。

 <target name="startHybrisServer" description="Starts the hybris Server">
    <callback extname="" target="before_startHybrisServer"/>
    <--**CUSTOM MICRO DEF**>
    <startHybrisServer/>
    <callback extname="" target="after_startHybrisServer"/>
</target>

然后保存文件并运行>>蚂蚁定制。

蚂蚁清理所有的&&hybrisserver.bat。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.