MFP CLI无法构建部署最初使用MFP Studio创建的项目 [英] MFP CLI cannot build-deploy project initially created with MFP Studio

查看:154
本文介绍了MFP CLI无法构建部署最初使用MFP Studio创建的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题背景

我们最初使用适用于Eclipse的MFP Studio插件在iOS环境中创建了MFP混合项目。我们在源代码控制下有这个项目(Git on DevOps)。我们团队中的一些团队成员正在为这个项目进行iOS开发,因为他们不熟悉Eclipse,所以他们想要使用CLI。同一团队中的其他开发人员将继续使用Studio,因为他们正在为MFP适配器编写Java代码,并希望利用Eclipse提供的功能,例如编译,代码自动完成等。

Problem Context:
We initially created a MFP hybrid project with the iOS environment using MFP Studio plugin for Eclipse. We have this project under source control (Git on DevOps). Some team members in our team are doing iOS development for this project and since they are not familiar with Eclipse, they are wanting to use the CLI instead. Other developers in the same team will continue to use Studio since they are writing Java code for the MFP adapters and want to leverage the capabilities Eclipse provides such as compilation, code auto-completion, etc.

问题

从Git(新鲜拉动)下拉MFP项目代码后,如果Studio首次用于构建所有环境和运行 MobileFirst Platform,我们可以毫无问题地运行MFP应用程序。然后我们也可以切换到用于构建和部署工件的CLI,并且CLI命令也可以正常工作。

Problem:
After pulling down the MFP project code from Git (fresh pull), if Studio is first used to "Build All Environments" and "Run on MobileFirst Platform", we can then run the MFP app without any problems. We can then also switch to the CLI for building and deploying artifacts and the CLI commands work just fine.

现在,说从Git下拉代码之后(新鲜拉),我们立即开始使用CLI来构建和部署工件,而不是使用Studio。在这种情况下,CLI会抛出错误。似乎CLI缺少Studio知道如何操作的步骤。在从Git重新获取之后立即使用CLI进行构建和部署( mfp bd )时出现的错误如下:

Now, say that after pulling down the code from Git (fresh pull), instead of using Studio, we start using right away the CLI for building and deploying artifacts. Under such scenario, the CLI throws errors. It seems that the CLI is missing steps that Studio knows how to do. The errors we get when using the CLI right away for building and deploying (mfp bd) after a fresh pull from Git are the following:

$ mfp bd 
All apps and adapters were successfully built.  
Initializing MobileFirst Console.

BUILD FAILED
/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml:147: Compile failed; see the compiler error output for details.

Total time: 1 second
Error: Build process failed. Please check the stack above for details.

BUILD FAILED
/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml:380: Element <project> inside <configureApplicationServer>: File '/Users/olivieri/git/Ready.App.3.Hatch/HatchReadyApp/bin/HatchReadyApp.war' does not exist.

Total time: 1 second
Error: Build process failed. Please check the stack above for details.
objc[81801]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
Starting server worklight.
Server worklight started with process ID 81800.
    [wladm] Unexpected response from http://192.168.1.126:10080/worklightadmin/management-apis/1.0/runtimes/HatchReadyApp/adapters?locale=en_US:
    [wladm] <?xml version="1.0" encoding="UTF-8"?>
    [wladm] <deploy-adapter-result ok="false" productVersion="6.3.0.00-20150214-1702">
    [wladm]   <transaction id="168" type="UPLOAD_ADAPTER" status="FAILURE" timeCreated="2015-04-13T13:53:18.599Z" timeUpdated="2015-04-13T13:53:18.870Z" userName="admin" appServerId="Liberty">
    [wladm]     <project name="HatchReadyApp"/>
    [wladm]     <description filename="SBBAdapter.adapter" name="SBBAdapter" alreadyDeployed="false"/>
    [wladm]     <errors>
    [wladm]       <error mbeanName="com.worklight.common.server.jmx.api:qualifier=HatchReadyApp,type=ProjectManagement" date="2015-04-13T13:53:18.831Z" phase="PREPARE" code="FAILURE" exception="RuntimeException" details="Runtime synchronization failed. Cannot deploy adapter to runtime"/>
    [wladm]     </errors>
    [wladm]     <warnings/>
    [wladm]   </transaction>
    [wladm] </deploy-adapter-result>

Error: The MobileFirst server that you have configured does not appear to be running. Start the server with 'mobilefirst start'.

更多详情

如果我在执行'mfp bd'之前先启动MFP服务器,它也会因类似错误而失败:

If I start the MFP server first before doing a 'mfp bd', it also fails with a similar error:

$ mfp start
Initializing MobileFirst Console.

BUILD FAILED
/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml:147: Compile failed; see the compiler error output for details.

Total time: 1 second
Error: Build process failed. Please check the stack above for details.

BUILD FAILED
/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml:380: Element <project> inside <configureApplicationServer>: File '/Users/olivieri/git/Ready.App.3.Hatch/HatchReadyApp/bin/HatchReadyApp.war' does not exist.

Total time: 1 second
Error: Build process failed. Please check the stack above for details.
objc[55444]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
Starting server worklight.
Server worklight started with process ID 55443.

MFP信息输出

$ mfp info
OS: darwin x64
Release: 14.1.0
System Memory: 89MB free out of 16384MB
Node: v0.10.30
MobileFirst CLI: 6.3.0.00.20150214-1708
Current directory: /Users/olivieri/git/Ready.App.3.Hatch/HatchReadyApp

Current project: /Users/olivieri/git/Ready.App.3.Hatch/HatchReadyApp

Adapter: getOffers (/Users/olivieri/git/Ready.App.3.Hatch/HatchReadyApp/adapters/SBBAdapter/SBBAdapter.xml)
Description: SBBAdapter
Type: http
Procedures: test, getUser, getAccounts, getTransactions, getGoals, getDashboardData, getFeasibility, submitAuthentication, getTradeoffSolution, getOffers

Application: Hatch (/Users/olivieri/git/Ready.App.3.Hatch/HatchReadyApp/apps/Hatch/application-descriptor.xml)
Description: Hatch
Type: hybrid application
Features: 
Environments: iphone
Skins: 

Server location: /Users/olivieri/.ibm/mobilefirst/6.3.0/server
Server binary: /Users/olivieri/.ibm/mobilefirst/6.3.0/server/wlp/bin/server
MobileFirst instance: /Users/olivieri/.ibm/mobilefirst/6.3.0/server/wlp/usr/servers/worklight
objc[85669]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
WebSphere Application Server 8.5.5.3 (1.0.6.cl50320140731-0257) on Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_51-b13 (en_US)

Environment variables:
TERM_PROGRAM: Apple_Terminal
ANDROID_HOME: /Users/olivieri/android-sdks
SHELL: /bin/bash
TERM: xterm-256color
TMPDIR: /var/folders/c9/gf_f0_sd60q1mm9kxwgvlxsr0000gn/T/
Apple_PubSub_Socket_Render: /private/tmp/com.apple.launchd.JKtd63AtGc/Render
TERM_PROGRAM_VERSION: 343.6
TERM_SESSION_ID: D5FA1866-C7B1-4AC0-A045-B8BD0AF18A5D
ANT_HOME: /Users/olivieri/Development/apache-ant-1.9.4
USER: olivieri
SSH_AUTH_SOCK: /private/tmp/com.apple.launchd.ECR6tzx7Xe/Listeners
__CF_USER_TEXT_ENCODING: 0x1F5:0x0:0x0
PATH: /Users/olivieri/Development/apache-ant-1.9.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/IBM/MobileFirst-CLI:/Users/olivieri/Development/gradle-1.12/bin:/Users/olivieri/android-sdks/tools:/Users/olivieri/android-sdks/platform-tools
PWD: /Users/olivieri/git/Ready.App.3.Hatch/HatchReadyApp
LANG: en_US.UTF-8
XPC_FLAGS: 0x0
XPC_SERVICE_NAME: 0
SHLVL: 2
HOME: /Users/olivieri
LOGNAME: olivieri
DISPLAY: /private/tmp/com.apple.launchd.8nfQqEAeMS/org.macosforge.xquartz:0
_: /Applications/IBM/MobileFirst-CLI/IBMnode/bin/node
WLP_USER_DIR: /Users/olivieri/.ibm/mobilefirst/6.3.0/server/wlp/usr


推荐答案

感谢帮助我们解决此问题的IBM人员。要解决此问题,我们必须对以下文件进行两处更改:/ Applications / IBM / MobileFirst-CLI / mobilefirst-cli / node_modules / generator-worklight-server / lib / build.xml

Thanks to the IBM folks who helped us resolve this problem. To fix this issue, we had to make two changes to the following file: /Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml

我们更换了以下两个部分[在此文件中],如下所示:

We replaced the following two sections [in this file] as shown below:

1)

 <!--
  <path id="server-classpath">
    <fileset dir="${worklight.jars.dir}" includes="worklight-jee-library.jar" />
    <fileset dir="${worklight.server.install.dir}/wlp/dev" includes="**/*.jar" />
  </path>
 -->

  <path id="server-classpath">
    <fileset dir="${worklight.jars.dir}" includes="worklight-jee-library.jar" />
    <fileset dir="${worklight.server.install.dir}/wlp/dev" includes="**/*.jar" />
    <!-- add server/lib folder to classpath -->
    <fileset dir="${worklight.app.dir}/../server/lib" includes="**/*.jar" />
  </path>

2)

<!--
  <target name="build-WAR" description="Build worklight WAR for project">
    <echo message="Building worklight WAR for project ${ProjectName}" />
    <javac
      srcdir="server/java"
      destdir="bin/classes"
      classpathref="server-classpath"
      verbose="true"
      includeantruntime="false"
    />
    <war-builder
      projectfolder="${basedir}"
      destinationfolder="bin/war"
      warfile="bin/${ProjectName}.war"
      classesfolder="bin/classes">
    </war-builder>
  </target>
-->

<target name="build-WAR" description="Build worklight WAR for project">
    <echo message="Building worklight WAR for project ${ProjectName}" />
    <!-- first clear out the existing bin/classes contents -->
  <delete includeemptydirs="true">
    <fileset dir="bin/classes" includes="**/*"/>
  </delete>
    <javac
      srcdir="server/java"
      destdir="bin/classes"
      classpathref="server-classpath"
      verbose="true"
      includeantruntime="false"
    />
    <if>
      <available file="server/java/resources" />
      <then>
        <!-- now copy the contents of server/java/resources into bin/classes so they get included in the war -->
      <copy todir="bin/classes/resources" failonerror="false">
        <fileset dir="server/java/resources"/>
      </copy>
      </then>
    </if>
    <war-builder
      projectfolder="${basedir}"
      destinationfolder="bin/war"
      warfile="bin/${ProjectName}.war"
      classesfolder="bin/classes">
    </war-builder>
  </target>

完成上述更改后,我们可以运行'mfp restart'和'mfp bd'命令没有任何错误。

After making the above changes, we could then run the 'mfp restart' and 'mfp bd' commands without any errors.

这篇关于MFP CLI无法构建部署最初使用MFP Studio创建的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆