Coming from a JVM background I would like to know how to deploy a golang project to production. Is there an equivalent of a JAR file?
Is there a standalone package manager that can be installed on server and a dependency manifest file which can be run to bring down all dependencies on the server. I specifically do not want to have to build the project on the server as we can't have any compilers etc on production boxes.
thanks.
I you run go install <pkg>, the binary will be placed in $GOPATH/bin. You can copy that binary to another machine that has the same OS and architecture.
You can also change into the directory that includes the main package and just run go build. The binary will be placed in the current directory.
There are no dependencies in a Go binary for you to track. It is statically linked. (Some system libraries may be dynamically linked, but if you are running on the same OS, this shouldn't be a problem.)
Related
I am trying to use Google Cloud Container Builder to automate the building of my containers using GCP Build Triggers
My code is in Go, and I have a vendor folder in my project root which contains all of my Go dependencies (I use govendor). However, this vendor folder is NOT checked in to source control.
I have a cloudbuild.yaml file where I first build my Go source into a main executable, and then build a Docker image using this executable. Container Builder ensures these build steps have access to my master branch.
The problem is that the Go compilation step fails, because the vendor folder is not checked in to source control, so none of my dependencies are available for any build step.
Is there a way to create a build step that uses govendor to install all dependencies in the vendor folder? If so, how? Or is the only option to check in my vendor directory into source control (which seems unnecessary to me)?
As per #JimB and #Peter's comments to my question, an easy solution is to add my vendor directory to Git so I don't have to download all my dependencies during the build steps.
I'm giving a Clojure workshop and I want people to be able to modify and recompile the Clojure project. The challenge is that they won't have internet connections - so I need to give them the project and the libraries all at once.
How can I package up a leiningen project for recompilation with all the libraries included?
Assumptions
They have leiningen installed on their machine prior to the workshop.
EDIT
This is almost the same question as How to package up a maven project for recompilation with all the libraries included? [without an internet connection]
Move your ~/.m2 directory aside. Run all the lein x leiningen commands you expect your users to have run, also build and test your project (test, install, jar, uberjar, etc.). This will have downloaded (a lot) of dependencies for Leiningen itself as well as for your project. $HOME/.m2 is where you'll find all the jar files that were pulled down by the Maven dependency resolver.
Once you've done this, add :offline? true to the project.clj, According to the documentation, this will Prevent Leiningen from checking the network for dependencies.
See Maven - alternative .m2 directory for an alternative to having to move your .m2 directory aside.
To make using it easy for your students, it may be best to create a self-contained zip archive with the entire .m2 directory, your project and Leiningen itself, along with a basic installer (bash script, or batch file) that moves or symlinks the .m2 directory into the proper place and adds the lein script to the path. This approach should satisfy the off-line needs - I think it covers all of the dependencies you would need.
I have assumed that your students will have java installed and have it on their PATH. Pre-running all of the lein commands you expect to use is important, as some of them have their own dependencies that are only resolved when they are first run.
I want to build a maven artifact that contains some executable native binaries so that other maven projects can depend on this artifact and refer to those binaries at build time.
I've looked at the maven-assembler-plugin and it appears promising, but I'm not sure how to get it going end to end. If I tell it to package up my dir I'll still need a way to tell clients to depend on that artifact and have that cause the binaries to be pulled in and put in a well-defined location.
Some specifics might help. I want to put the various platform versions of the thrift compiler into an artifact. Then I want clients to depend on that artifact and use the maven-thrift-plugin to execute the binary thrift compiler appropriate to the platform to generate the java code that will then be built by the java compiler.
The maven-assembly-plugin should be sufficient to package your native binaries into an archive.
Clients can the use the unpack goal of the maven-dependency-plugin to unpack this archive into a given directory, e.g. the current target.
Then all you need is a Maven plugin that knows how to run your native binaries and to pick them up from the given directory.
Is there any build tool running in Windows environment that manages versions of modules in a set of recipes? Recipes should define from which source to build, how to build, and dependencies between the modules. I'd like the above meta-data about the module to be separated from the code its building, not like Ant/Ivy or Gradle (as a version/dependency file in the source repo).
I like the way package dependency handling in Linux work.
Actually, I want bitbake for Windows. Is there something similar?
You can use pretty the same bitbake using Yocto by Intel on Windows and with Eclipse plugin.
i have to install JRE Programmability if the System does not have JRE, i had dected JRE is installed in the system or not, but i have no idea how to install JRE programmtically, some people said you can use installer, but i donot know how to use installer for this purpose i searched in sun documnet, installing JRE in slient mode, there's also i donot know how to use that command iie.fing.edu.uy/ense/asign/…
In order to run your Java program, you can do that without installing the JRE, that its, you can run the application in a computer without JRE, we do that every day.
The way is to deploy you application with an embedded JRE and use a script (.bar, .sh) to execute you application using the embedded JRE. So your application is self-contained and no requires external JRE. You need to copy the entire JRE folder into your application and start removing unused files using the test-error approach. You can also decrease the file sizes removing not needed classes, like in rt.jar (you can decompress, remove unused classes and zip again).
The problem with this approach is that you are violating the Oracle/SUN JRE distribution policy as you are distributing a JRE with fewer files. If the application is for internal use, I think it's OK, if you want to redistribute the application, you are in trouble.
Another question is how to install the JRE by code, you can try to ship the JRE with your application, using an installer detect if JRE is already installed and install it id needed. Doing that in Java code is not trivial, you can use Runtime to exec external programs...
Do not rely on JAVA_HOMEas is not actively used nowadays.
Example:
Say you application name is 'A', you folder structure can look like:
A
|-> Run.bat
|- jre
|- bin
|- lib
|- lib
|-> A.jar
You application main class is Main.java in package a. Your Run.batcan look like START "" jre\bin\javaw.exe -cp lib\A.jar a.Main
You only are calling the embedded jre in jre folder, by calling the bin\javaw.exe and passing the jar and main class. The jre folder can content and entire JRE as copied from c:\Program Files (x86)\Java\jre6\ (Windows 7).
If you can have a web based solution you can use deployjava
http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html