wlServerContext value coming '/' after building the environment file from ant script - ant

I built my project by using "build-app" ant task. After build is finished I noticed that value of wlServerContext attribute in "wlclient.properties" and "worklight.plist" is coming '/' instead of '/MyProject/'. If I build my project from eclipse then everything is coming just fine. I am using Worklight 6.2 Consumer Edition.

In the worklightserverhost attribute, you must include the project name which will be your context root.
Try this:
worklightserverhost="${wl.server.protocol}://${wl.server.ip}:${wl.server.port}/${wl.runtime.name}"

Related

Setting up a Rascal example project

How do I setup a Rascal-MPL project to consume the DSL built with Rascal?
I don't seem to find any resource that details how to solve that particular problem
The documentation hasn't been written for that case but here goes:
Use newRascalProject from util::Reflective to create a basic setup. For both the DSL project and the consuming project that makes sense.
mvn install in the DSL project, if you won't have the DSL project folder open in Eclipse or VScode or if you are working bare bones Unix/Maven.
In RASCAL.MF of the client project add Require-Libraries: |lib://dsl-project|
In pom.xml of the client project add a dependency on the DSL jar.
Restart the console or terminal for a file of the client project.
In the terminal the active version of the path configuration for the interpreter will be printed. It should have the DSL project in the list of srcs.
In VScode log for the Rascal LSP you can see the path configuration printed when compiling/checking source files in the client project. There the DSL project should be in the libs path.
If the DSL project isn't compiled to .tpl files that appear in the target folder and eventually in the jar, you will get spurious error messages in the client code. In that case trigger the compiler in the DSL project by saving the top module, or run mvn install again. Revisit the pom file for the settings of the rascal-maven-plugin
For those landing at this page and trying to find an example of calling newRascalProject with working parameters...
The first parameter is a 'location'. While it is documented how to use this parameter (https://www.rascal-mpl.org/docs/Rascal/Expressions/Values/Location/), it still took my some time to figure out that a location is not a regular string, and not using double quotes " but |.
So if you try:
newRascalProject ("home:///Projects/rascal_playground", "hello2")
You get the following error:
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UndeclaredVariable/UndeclaredVariable.html|
Including the variable name for the 2nd parameter...
newRascalProject ("home:///Projects/rascal_playground", name="hello")
... gives the same error.
This is the correct example:
newRascalProject (|home:///Projects/rascal_playground|, name="hello")

Grails 4 and Views-Json 2 : Build fails

I'm trying to upgrade a Grails app from 3.3 to 4 (specifically 4.0.3 for now) and the Views-Json 2.0.2 plugin. Profile is angular.
When I run the app in development mode everything works. However when I attempt to build using gradlew :server-api:assemble the build fails at the Task :server-api:compileGsonViews (yeah, renamed 'server' to 'server-api' for clarity).
It looks like it's not finding my Java classes (there are a few under src/main/java).
I've see refs to setting the classpath for the compileGsonViews, but I was undable to make it work.
Anyone with suggestions?
Running on Windows 10 with latest OpenJDK 1.8.x
Somehow I seem to have stumbled on the solution. In my build.gradle I had enabled the grails pathingJar, commenting that out allowed my war to build. However with the property commented out, I was unable to use the gradlew bootRun command as it failed due to the path being too long.
The solution (for me) was to add a build property, the build file then looks like:
def usePathing = Boolean.valueOf( System.getProperty('pathingJar', 'false') )
if (usePathing) {
grails {
pathingJar = true
}
}
If I was better with gradle I think I could (maybe) determine the goal that is being targeted and use that, but the above works. The commend to assemble the war is the same; but to run the app directly I need to make it gradlew server-api:bootRun -DpathingJar=true

TFS Build using vstest.console.exe.config instead of app.config

For some time we had TFS2017 run our unit test (xUnit) in the build proces. Every test project has it own app.config file declaring some appSettings.
Our code is looking at those app settings like ConfigurationManager.AppSettings["someSetting"]
Recently, some developers upgraded from VS2015 to VS2017 (not sure if it is related), our test started to fail.
Turns out that the the appSettings where loaded from vstest.console.exe.configinstead of the app.config file included in the test project.
While we where able to add our settings to vstest.console.exe.config this is not our preferred solution, we would like to have the test using the app.config file again.
Any ideas on how to accomplish this? I have no idea what changed in the first place.
Make sure WorkingFolder is not changed. It should be relative to the folder containing the test.dll.
Also, you can try the <exec> task in MSBuild to run the console runner.
When running multiple assemblies, you can specify the configuration file for each assembly using ItemGroup metadata. The <xunit> task looks for metadata named ConfigFile on each item in your item group. Configuration files are ignored when AppDomains is set to false.

Why is org-netbeans-modules-java-j2seproject-copylibstask.jar required failed ant build

When doing an ant build (thought jenkins) for a test project, I get the below error. As this test project will be deployed in tomcat why does the build require a netbeans specific module
Obviously I can add the jar file to a path in jenkins and then continue the build, but want to know why it needs a netbeans specific jar?
Is it because the project setup in Netbeans is wrong?
Thanks in advance.
Tony
======Error below here =========
var/lib/jenkins/workspace/DeployTest2/nbproject/build-impl.xml:797: The libs.CopyLibs.classpath property is not set up.
This property must point to
org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
of NetBeans IDE installation and is usually located at
/java/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library
exists or setup the property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar

Apache Ant argument to generate portlet only

I'm working with Liferay and generating portlets with a Apache Ant-based build.
I want to generate a portlet project only without compiling it's codes.
How can I do it? What arguments must be passed to the ant command?
Just simply use the create.sh script that is in the portlets directory under the Plugins SDK to create a new portlet plugin project.
Install Plugins SDK
Go into portlets subdirectory on command line
Run the create.sh/create.bat and pass two arguments, one for name of portlet project and other for the display name.
All of this is fully documented here along with how to perform the same task using Liferay IDE (Eclipse plugin for Liferay development).
There are 2 files in the myProject-xmlportletfactory folder under the XmlPortletFactory folder: build.xml and myProject.xml.
When I run the ant in this path, it runs the build.xml.
In the buil.xml file, under the <target> tag there are to <ant> tags, the first builds services and classes for the project and the second compiles and deploys the project. if I delete the second tag and run the ant, it will build the project only and dont compile it.

Resources