I can't put all the bits together.
Following this example I have a run/debug configuration that builds $PROJECT/out/artifacts/kitten_jar/kitten.jar (kitten being the project name, obviously).
I also have a 'Run Target' which is the deployment machine, running ssh, and IntelliJ's 'Test Connection' button works.
Outside IntelliJ at the command prompt I can run scp out/artifacts/kitten_jar/kitten.jar Rocky:kitten.jar to copy the JAR file manually (Rocky here is an entry in my ~/.ssh/config).
What I would like is a one-touch build and scp action in IntelliJ that builds the JAR and scps or rsyncs it to the deployment machine. I don't want to debug it on that machine.
Bonus points if the one-touch build and scp action will also ssh a command afterwards (that command being sudo /root/kitten-restart.sh which will restart the systemd service that runs the JAR).
All the information I can find is about debugging remotely which is not what I want. I wonder if I'm trying to do something weird or inadvisable, since I can't readily find how to do it.
Related
How do I run several buildsteps after each other in IntelliJ? I think I want a mini CI/CD build system inside the editor.
For example, the project I work on now is a Spring boot and javascript web site. I need to build it with maven with mvn clean package -Pdockerimage. This copies files for building the Docker image to target/dockerimgbuild.
Then I want to build the docker image using docker build -t scheduling-ui-dev . and after that run it with docker compose docker-compose up --build from src/main/resources/docker-compose.
I have built one run configuration for each of these steps but how do I run them after each other? I have found that you can have before launch but the system is clunky and complains if target/dockerimgbuild doesn't exists even before it have run the maven step which creates it. Latest problem I stumbled on was that a file prevented maven from removing target/dockerimgbuild and all run steps was automatically removed from the run configurations.
There is a run configuration called compound but that runs everything in parallell and you can not specify order which is a problem.
I wonder if it is feasible to start TeamCity in a container, do anyone have a clue about that (is teamcity easy to configure, how to make it launch a docker-compose container on my host machine etc)?
My solution right now is to have several terminals (if this gets more permanent I will replace it with a script) where I just press up and enter to execute the steps manually. Seems stupid as I guess maven itself can do all of this...but I don't know how or how much work it is.
There is a compound Run/Debug configuration: https://www.jetbrains.com/help/idea/run-debug-configuration-compound-run-configuration.html
Also, there is a multi-run plugin: https://plugins.jetbrains.com/plugin/7248-multirun
I would like to choose the user for run configuration so that my application runs with reduced permissions.
Unfortunately there doesn't seem to be any option available for this in Intellij.
Only way I can think of so far is to run as "Shell script" and clean/package my JAR in "before launch" configuration. This however requires a lot of manual configuration and cannot be used to run tests. It becomes even more annoying when the user has a password (which could be stored in Intellij's configuration like database passwords for example).
I've found the "shorten command line" option but I don't see any way to add my own configuration. If I could, it would be something like:
sudo -u nobody java [options] className [args]
If program can be run via command line - you can try using External Tools to run it.
When building the project from command line using mvn clean install everything builds without any issues.
When running some tests that use precompiled C libraries from IntelliJ, tests fail with java.lang.UnsatisfiedLinkError
I may be completely off here, but does IntelliJ not see the .so file? Is so, how can it be added please?
Shared library fails to load with UnsatisfiedLinkError if:
it's not in the working directory configured in the test run configuration.
it's not in PATH environment (on Mac Terminal and GUI apps have different environment, see this answer). Run IDEA from the Terminal open -a /Applications/IntelliJ\ IDEA\ 12.app/ to make environment the same.
it's not in the location specified using -Djava.library.path VM option.
.so depends on some other library that is not found for any of the 1-3 reasons (or the dependency of that dependency is not found, etc).
I'm having trouble setting up a slave device in Jenkins to build my .net projects. The error I keep getting is FATAL: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe doesn't exist. MSBuild DOES exist on the VM slave in the path above.
I am using the Jenkins MSBuild plug-in, version 1.15 (also didn't work using 1.13). I have set the "path to msbuild" as "C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" with no default parameters and install automatically unticked. If I run the same project configuration on the master node, it builds fine.
I have also tried setting the Node Properties - Tool Locations for the slave node but this has no effect either.
Does anyone know how to get Jenkins to see MSBuild on a slave node?
Thanks
Tom
I had a similar problem. Make sure you do not have quotes in the path in your config. When you "copy as path" using the left-shift right-click method in widows it adds quotes.
I managed to insert whitespace into the beginning of the MSBuild executable path, which apparently made the check-if-exists logic performed by Jenkins to fail. You would think the MSBuild plugin would trim the input prior to committing the configuration... just remove it and you are fine!
I've looked at the usage, but haven't understood from it how to configure multiple servers. I added separate server elements to settings.xml - but I don't understand how to specify a different URL for every server.
The URL element belongs to the global plugin configuration. How do I configure multiple server URLs?
You could add multiple profiles to your pom.xml. One for each server. Check the Maven documentation on profiles for details!
If you examine the documentation of the Tomcat plugin you will see that it does not support multiple <configuration> sections. That should be a small addition because in the deploy phase you only copy the WAR file to the server using an HTTP PUT command. So I wonder why they have not added this capability to the plugin.
Anyhow, one possible workaround is to:
Make multiple copies of your pom.xml in the same directory but give them unique names, e.g. dev_1_pom.xml, or dev_<some_machine_name_or_IP>, qa_1_pom.xml ..... You can keep your development pom.xml file name the same because you will likely still run Maven from the command line. Personally, I prefer running the mvn command from my IDE (a button click away vs. typing an mvn command with arguments every time).
In each of the copies, change the <configuration> section under your Tomcat plugin to point to a different server that matches the name of your specific pom.xml. You will need corresponding sections in settings.xml
Create corresponding External Tools Configuration(s) (Eclipse, or other IDE) and each one call the corresponding POM file. Here is an example with Eclipse:
Open External Tools Configuration Dialog in Eclipse (either from the dropdown menu next to the button, or by going to the menu bar and clicking Run > External Tools > External Tools Configurations). Then on the Main Tab, provide values for the following fields
Location: C:\downloads\tools\apache-maven-3.0.3\bin\mvn.bat
Working directory: ${workspace_loc:/<project_name>} - replace <project_name> with the name of your project
Arguments: -f <pom_file_name> <other_arguments> - <other_arguments> could be tomcat7:redeploy
Now you can run these external tool launchers individually to deploy to different servers.
Optionally, extract the mvn commands from your launchers and create a shell script (batch or Unix bash script) that runs all of them. That way you can deploy to multiple servers at once. You can also run this script from Eclipse. Create a new External Tools Configuration launcher but this time your Location: field will point to cmd (Windows) or bash (Unix, Linux ...), not mvn