I have installed
Eclipse Kepler Edition
IBM Worklight Studio plugin version 6.1
And now i want to deploy using ANT script as below :
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="target-name">
<taskdef resource="com/worklight/ant/defaults.properties">
<classpath>
<pathelement location="WL_INSTALL_DIR/WorklightServer/worklight-ant.jar"/>
</classpath>
</taskdef>
<target name="target-name">
<app-builder
worklightServerHost="http://server-address:port"
applicationFolder="adapter-source-files-folder"
environments="list-of-environments"
nativeProjectPrefix="project-name"
outputFolder="output-folder"/>
</target>
</project>
But, I can't find worklight-ant.jar and also worklight-ant-deployer.jar. What software should I install in order to get those file available ?.
If you have Worklight enterprise edition you can get the worklight-ant.jar from server.
If you want to start the Ant task from a computer on which Worklight Server is not installed, you must copy the files <WorklightInstallDir>/WorklightServer/worklight-ant.jar and <WorklightInstallDir>/WorklightServer/worklight-jee-library.jar to your computer.
for more info link
Related
I would like to use a visual studio proj file to transform xml files. I am following this article. http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx . This works for me locally, however when deploying the application on Azure DevOps it fails. It cannot find Microsoft.Web.Publishing.Tasks.dll. How do I set up a build task that will only transform the config files.
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="TransformXml"
AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
<Target Name="Build">
<TransformXml Source="Web.config"
Transform="Web.Release.config"
Destination="Web.Production.config" />
</Target>
</Project>
Turned out to be an easy fix. It was an old build so that the hosted agent. Just had to change it to the Hosted VS2017 agent.
AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
I think that's why the issue happens. For a vs2017 agent, you need to change the v10.0 to v15.0, so that the msbuild tool can find the assembly.
Also, as for vs2017, make sure you set the correct msbuild tool path in VSTS like this issue.
I am using Visual Studio online build with an MSBuild task. I currently have the following MSBuild Arguments fed to my task:
/p:Configuration=Release;AppxBundle=Always;AppxBundlePlatforms="x86|x64|ARM";AppxPackageDir="$(Build.BinariesDirectory)\AppxPackages\\";UapAppxPackageBuildMode=StoreUpload
This creates my application in x86, x64 and ARM. It creates Release version of the libraries in x86 BUT creates Debug version of my libraries in x64 and ARM.
When my .appxupload package is creates it fails Windows Certification tests because my libraries are built in debug.
How can I make MSBuild build for all 3 configurations. My guess is because I haven't provided a /platform configuration. How do I provide this configuration for 3 platforms?
I have tried platform="x86|x64|ARM" but it returned an error
For a standard project file there's no way to do this in a single command. Either use multiple commands to build the project for each platform/configuration combination needed, or use a 'master' build file which does the same for you, something like:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="FullRebuild">
<Target>
<ItemGroup>
<Configurations Include="Debug;Release"/>
<Platforms Include="x86;x64;ARM"/>
<ConfigAndPlatform Include="#(Configurations)">
<Platform>%(Platforms.Identity)</Platform>
</ConfigAndPlatform>
</ItemGroup>
<MSBuild Projects="myproject.sln" Targets="Build"
Properties="Configuration=%(ConfigAndPlatform.Identity);Platform=%(ConfigAndPlatform.Platform)"/>
</Target>
</Project>
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.
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.
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'.
More details:
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 info output:
$ 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
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>
After making the above changes, we could then run the 'mfp restart' and 'mfp bd' commands without any errors.
I'm trying to do some MSBuild automation for deploy and backup. I tried several different remote execution platforms (Powershell/WMI, PsExec and Cygwin) and had some troubles with all of them.
With Powershell and PsExec, I think the problem is some security baselines used on the machines. I don't have full control of the machines and domain.
The most stable scenario I found is with cygwin/openssh. But when I'm running plink inside MSBuild and trying to invoke MSBuild remotely, msbuild hangs without telling me the error. If I run directly plink from prompt, everything works fine.
The MSBuild script follows:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Plink>"c:\Program Files (x86)\PuTTY\plink.exe"</Plink>
<UserName></UserName>
<Password></Password>
<HostName>localhost</HostName>
<RemoteCommand2>/cygdrive/c/SandBox/remotemsbuild/echoalotoffiles.bat</RemoteCommand2>
</PropertyGroup>
<Target Name="Build">
<Exec Command="$(Plink) -l $(UserName) -pw $(Password) -batch $(HostName) $(RemoteCommand2)" />
</Target>
<Target Name="EchoALotOfFiles">
<ItemGroup>
<SandBoxFiles Include="$(MSBuildProjectDirectory)\..\**\*.*" />
</ItemGroup>
<Message Text="#(SandBoxFiles)" />
</Target>
</Project>
When I run the first target, Build, I have the issue (MSBuild hanging)
Microsoft (R) Build Engine version 4.0.30319.17929
[Microsoft .NET Framework, version 4.0.30319.17929]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 02/11/2013 12:01:45.
Project "C:\SandBox\remotemsbuild\remotemsbuild.build" on node 1 (EchoALotOfF
iles target(s)).
EchoALotOfFiles:
If I run just plink from command line, everything works fine.
Any guesses?
Where is sun-appserv-ant.jar in Glassfish v3
I have created a small sample EJB project and I want to use ant to deploy the application to Glassfish v3.
Ive spent a lot of time on google trying to achieve this and all ant samples seem to refer to a jar file called "sun-appserv-ant.jar" which is supposed to be located in the modules directory of the application server install, however, I cannot find it anywhere, nor can I seem to find the reason why, or if there is even an ant based alternative.
Thanks
The sun-appserv-ant.xml file was not brought forward with v3.
You are not completely stuck though.
You can read about the Ant exec task, which you can use to trigger asadmin commands.
If you are very adventurous, you may want to investigate the bp-project framework that is used by the sample projects that ship with the Java EE 6 SDK.
You can get a peek at the bp-project framework by looking at the code in the glassfish-samples repository.
You should add the glassfish-ant-tasks module through the GlassFish Update Tool
After much agony I found an example of how to use the V3.x ant tools here
The downside, for non-French-speakers, is that it's in French. The upside is that the Java parts are still in Java.
From what I can tell, the Ant tasks now differ significantly from what is documented by Sun (Oracle):
You must use the Glassfish server update tool to get the glassfish-ant-tasks module.
This will cause the file *glassfish_dir*/lib/ant/ant-tasks.jar to be downloaded. That must be included on your classpath
Define an as-ant-init target in your build.xml
<target name="as-ant-init">
<taskdef name="sun-appserv-deploy"
classname="org.glassfish.ant.tasks.DeployTask"
classpath="${build-lib}/ant-tasks.jar" />
<taskdef name="sun-appserv-undeploy"
classname="org.glassfish.ant.tasks.UndeployTask"
classpath="${build-lib}/ant-tasks.jar" />
<taskdef name="sun-appserv-component"
classname="org.glassfish.ant.tasks.ComponentTask"
classpath="${build-lib}/ant-tasks.jar" />
<taskdef name="sun-appserv-admin"
classname="org.glassfish.ant.tasks.AdminTask"
classpath="${build-lib}/ant-tasks.jar" />
<taskdef name="sun-appserv-redeploy"
classname="org.glassfish.ant.tasks.RedeployTask"
classpath="${build-lib}/ant-tasks.jar" />
<taskdef name="sun-appserv-start-server"
classname="org.glassfish.ant.tasks.StartServerTask"
classpath="${build-lib}/ant-tasks.jar" />
<taskdef name="sun-appserv-stop-server"
classname="org.glassfish.ant.tasks.StopServerTask"
classpath="${build-lib}/ant-tasks.jar" />
</target>
Write the deployment target. The rules are similar to what's in the documentation, EXCEPT
A. Remove references to the <server> element that was used in older versions.
B. All of the attributes that would have been attached to <server> in the older version of the API are now attached directly to the containing element, such as <sun-appserv-deploy>, like so:
<target name="deploy">
<sun-appserv-deploy
user="${glassfish.admin-user}"
passwordfile="${glassfish.passwordfile}}"
host="${glassfish.host}"
port="${glassfish.admin-port}"
installDir="${asinstalldir}"
upload="true" >
<component
file="${dist.warfile}"
name="My application"
contextroot="${glassfish.context-root}" />
</sun-appserv-deploy>
</target>