Maven antrun plugin run with JDK specified with toolchains plugin - maven-antrun-plugin

Is there any way to make maven run ant with a JDK that is defined using maven toolchains plugin?
Why?
I'm testing if I can convert a legacy ant based project to maven based project. Seems parts of it are next to impossible to do with maven so I need to do those with ant. At one point I need to compile using JDK 6 (and it needs to be 6, see e.g. bootstrap class path not set ). Seems maven runs the antrun with the JDK version it is running and toolchains are not taken into consideration (which is ok because the https://maven.apache.org/guides/mini/guide-using-toolchains.html does not display antrun as compatible plugin).

I had maybe a related issue and and least for a subset of Java related Ant tasks the attribute jvm or executable and setting fork=true to set the used JVM might be helpful. I assume the problem in your case might be solved with javac and java. In my example I had to use Java 8 for an older Java program not running with Java 17:
<java classname="com.sun.javacard.converter.Main"
failonerror="true" fork="true"
jvm="${JAVA_8_HOME}/bin/java">
<jvmarg value="-Djc.home=${jc.home}"/>
...

Related

How to create a self-starting C++ systemd service with CPackDeb?

I'm new to Debian packaging and I believe this is a fairly basic question, but I am embarrassed to say I've struck out on Google.
I have a C++ project which builds with CMake and packages a debian with CPack. This project has a service component (systemd style). My goal is to have the service enabled & auto-started upon installation of the package.
My research has yielded two approaches:
1) Run various systemctl commands inside the {pre,post}{inst,rm} scripts in the Debian. Care is required to handle install, remove, and upgrade scenarios properly.
2) Simply put the project.service inside the debian directory and let debhelper (with dh_systemd_enable) handle service installation and start 'automagically'.
Option #2 is obviously preferred because the {pre,post}{inst,rm} is very manual and thus error-prone, but I cannot figure out whether there's a well supported way to leverage debhelper from within CPack.
The Question: I'd like to avoid rewriting the debian packaging stuff in my project's CMake as it's been around for some time and works well. The relationship (if any) between CPackDeb and debhelper is not clear to me -- can CPack take advantage of the dh_systemd_enable features or must I manage the service manually in {pre,post}{inst,rm} scripts?

Eclipse CDT missing C/C++ Unit

I'm tasked with hooking up Google Test in Eclipse. I got Google Test working from the command-line, but we want it working like JUnit for Java in Eclipse. This is theoretically possible. However, running through all the online instructions I can find, they all say to use Run -> Run Configurations... -> C/C++ Unit option. For the life of me, I can't find it. Everything else is in the Run Configurations dialog, just not that item.
So I figured, even though we have Eclipse for C++ Developers installed (which should contain everything that the CDT Plug-in contains), maybe it's missing the unit testing stuff. Trying to update CDT, however, just shows that the only thing missing is the Autotools stuff (which we have no need for).
Vital statistics:
Eclipse version: Oxygen.1a Release (4.7.1a)
Operating System: Linux, CentOS
Compiler: gcc
I know that's the not the latest version of Oxygen. It's the latest we can use, because the current versions have a bug that doesn't recognize our code as valid C++.
How do I get the C/C++ Unit option in Run Configurations?
You need to install "C/C++ unit testing support" feature. Go to Help -> Install new software, select All available sites and search for it. Installing it will require Eclipse restart. After restart C++ unit test group will appear in the list of Debug configurations.

build dotnet solution in travis against netstandard20 and framework462

TLDR; I've got a mixed solution: NetStandard 2.0 for the library I'm actually developing and .Net Framework 4.6.2 (or alternatively dotnetcore 2.0) for the tests. How to configure travis.yml to build the library and the test project as well.
I'm actually working on a client for a rest api. I decided to use .NET Standard 2.0 as project type. As it is a REST based api, I decided to use Newtonsoft.Json to deserialize and serialize the content.
A problem occurred: the nuget package Newtonsoft.Json 10.0.3 doesn't support NetStandard 2.0 by now. But I found the commit ab3315f does. So I cloned the repo and build the netstandard library on my own as a workaraound till the new version is available in NuGet.
I added the project to CI system travis following this post: https://rimdev.io/building-net-core-on-travis-ci/
Now I added a test project to my solution using Nunit to run unit tests and integration tests for my library. No I'm facing 2 problems and I need to solve one:
problem 1: When my test project targets .NET Framework, I'm able to execute all the unit tests without any problems, but now travis complains based on my travis.yml there's no mono installed to build the complete solution correctly.
my question here: how to change my .travis.yml to build both project types within the solution.
problem 2: When my test project targets dotnetcore, my local build works, but when I try to execute tests locally, I get a runtime error:
System.IO.FileNotFoundException : Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null'.
That's why I didn't test travis build by now, as I want to get it running locally first if this is the solution. I don't know why it doesn't find the dependency.
Any suggestions either for problem 1 or for problem 2?
I ended up adding NuGet package of Newtonsoft.Json 10.0.3 to my dotnetcore test project though it is not directly used there. Now the runtime error diappeared. So I am able to test locally and remotely as well and let travis CI build my project.

Use Jenkins CI for Qt projects

I'm trying to use Jenkins for some project I have written in Qt framework.
There is qmake plug-in for Jenkins in Jenkins wiki page, although this plug-in doesn't exist in Jenkins plug-in list.
I've looked for .hpi file for qmakebuilder plug-in, couldn't find it though. So I download the source code from the given repository, tried to compile it as described in Jenkins wiki... but I get list of error indicating java.util.NoSuchElementException.
Any of you guys have used this plug-in? or any other Jenkins plug-in to compile Qt projects with?
First of all, my JAVA_HOME variable was not pointing at the right folder i.e. JDK folder and it was set to JRE which caused the maven to not work properly.
But after fixing that, I was still getting some compilation error.
Finally, I asked Jenkins people and realized for some reason qmakebuilder is not compatible with JDK 7. Therefore, I download the JDK 6 compile the code with that version and it got compiled just fine. I got the hpi file in the target folder.
Plus, the hpi file for this plug-in NOW can be find here.

Developing for BlackBerry with IntelliJ

I wonder if someone has idea about next.
I'm developing for BlackBerry. IDEA doesn't recognize RIM installation as JSDK or Mobile SDK. So I have create project without SDK and attach RIM jar file as dependency.
I'm trying to write as much as possible unit test with JUnit and Mockito but to run them IDEA requires JSDK. So I created additional module where I set JSDK, correct language level and it works. It's already hassle to create additional module (better if we could set JSDK and other compiler, runtime options for code and tests) but I was quite happy.
I have also dependencies for some common libraries which we use in android and J2ME also. I added them as modules with JSDK 1.6 and language level 1.3. And I able to develop and run test on it also.
But I got issue with LEDA EAP. IDEA now complaints about incompatibility with java.lang because it found them both in RIM jar and JSDK for libraries. And now I'm thinking about next hassle to fix my favorite ide. Sure it's EAP and things could be changed.
But anyone has any recommendation or similar situation setup?