首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在服务器启动上启动节点服务器

如何在服务器启动上启动节点服务器
EN

Stack Overflow用户
提问于 2020-05-02 08:56:36
回答 3查看 849关注 0票数 0

SAP商业1905

我有一个节点应用程序,我想要与我的海布里集成。我已经创建了一个自定义的addon,并将我的节点应用程序文件放入了addon扩展名中。现在,我想在海布里服务器启动上运行下面的命令。

代码语言:javascript
复制
nohup npm start > output.log&

通过将npm命令放在myextension_compileuisrc_executor构建回调下,我能够在ant构建中启动节点服务器。

但我的目标是只在myextension_compileuisrc_executor上执行npm安装,而不是节点服务器启动。

这就是为什么我正在研究在海布里服务器启动上启动node.js服务器的方法。在buildcallback中找不到任何可以插入服务器启动命令的目标。

如何做到这一点?

更新:

我也和myextension_before_startHybrisServer试过了,但没有运气-

代码语言:javascript
复制
<macrodef name="myextension_before_startHybrisServer">

    <sequential>

        <npm-start/>

    </sequential>

</macrodef>
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2020-05-12 03:07:24

嗨,我试着写一个普通的宏

代码语言:javascript
复制
    <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

命令:>ant startHybrisServer

票数 0
EN

Stack Overflow用户

发布于 2020-05-11 05:46:34

嗨,请试着在构建-回调中编写自定义微。

代码语言:javascript
复制
<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>

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

代码语言:javascript
复制
<macrodef name="xxxstorefront_compileuisrc_executor">
    <sequential>
        <xxxstorefront_getnpm/>

    </sequential>
</macrodef>
票数 0
EN

Stack Overflow用户

发布于 2020-05-11 14:45:08

有一个解决办法,你可以试试。

请制作一个像这个\hybris\config\customize\platform\resourcesant/platformadministration.xml的文件夹

并复制现有的platformadministration.xml并创建自己的微定义:

代码语言:javascript
复制
<macrodef name="xxxstorefront_getnpm">

代码语言:javascript
复制
    <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中添加新创建的微定义,就在此之上。

代码语言:javascript
复制
 <target name="startHybrisServer" description="Starts the hybris Server">
    <callback extname="" target="before_startHybrisServer"/>
    <--**CUSTOM MICRO DEF**>
    <startHybrisServer/>
    <callback extname="" target="after_startHybrisServer"/>
</target>

然后保存文件并运行>> ant自定义。

ant clean && hybrisserver.bat

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61556778

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档