How does homebrew sets environment variable - environment-variables

I am installing Formula using homebrew on OS X 10.9. After installing Maven using homebrew i could not find where is M2_HOME being set. Though if i run "mvn --v" it works but i still can not find M2_HOME.
How does homebrew manages environment variable.

/usr/local/bin/mvn is a shell script that does some advanced guessing about where the Maven files are installed and sets M2_HOME before executing Java.

Related

java.nio.file.NoSuchFileException: /target/classes/META-INF/annotations/hudson.Extension when building Jenkins plugin

I have found a plugin for using StatsD with Jenkins (https://github.com/joemiller/jenkins-statsd-plugin) - however the HPI needs building because it is not available in Jenkins plugin repository nor is it aailable to download.
I followed the official instructions at https://wiki.jenkins.io/display/JENKINS/Plugin+tutorial, but the $ mvn package always exits with [ERROR] java.nio.file.NoSuchFileException: ~/src/jenkins-statsd-plugin/target/classes/META-INF/annotations/hudson.Extension.
I have tried using java 6, 7, 8 and 10 but to no avail.
I wonder if anybody else has come up against this problem building Jenkins plugins and what they're solution was?
I fixed this problem by setting JAVA_HOME to point to Oracle’s version of Java 8. It appears maven uses the JAVA_HOME environment variable, not your $PATH.
Edit: For extra context, Jenv was responsible for the version of Java in my $PATH.
I would like to post here my findings from various sources that worked for me as the accepted answer alone was not sufficient.
I had to downgrade my Java version back to 11 from 13.
I used this quick solution, which doesn't require you having JDK and Maven installed locally.
Moreover, deleting target/classes/META-INF/ directory before executing mvn install again was necessary.
Lastly, passing -Djenkins.version parameter to Maven is required so you need to do something like mvn -Djenkins.version=2.164 install
This will definitely get resolved by using java 1.8.* JDK.

Provision Travis CI PHP VM (trusty, sudo required) locally

Goal
I try to find the reason why a Laravel Dusk test fails on Travis CI, that is why I am trying to reproduce the used Travis CI environment locally.
Setting
In my .travis.yml I have
sudo: required
dist: trusty
since Laravel Dusk requires this.
This is why I am trying to reproduce a "full VM environment" locally (not a Docker based environment).
Current findings
I found out so far that Travis uses Chef to provision the full VMs or the packer templates, which eventually wrap the travis-cookbooks?
Question
How can I provision the "Travis full VM trusty sudo required" locally on Mac OS X?
An answer from Travis CI support states that it is not possible to do what I want:
Regarding your question about instructions for provisioning these
images from OS X, unfortunately, this is not possible at the moment
being so we don't have further instructions for that
Theoretically the following must be done: The travis_ci_sugilite Cookbook needs to be provisoned locally, the best starting point I could find is the Travis CI Packer Templates Readme.
In my case I could solve the failing build by using the new debug job feature.
Try setting set LD_LIBRARY_PATH which is like PATH for libraries. For example:
LD_LIBRARY_PATH= $HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
More detailed information about library path variables is here.
Environment variables that specifically influence how the configure script passes arguments to compilation are LIBS and LD_FLAGS. bash ./configure --help mentions these.
And as you mention in the comments LIBRARY_PATH also needs to be set. See LD_LIBRARY_PATH vs LIBRARY_PATH for an explanation of the difference.

0.8.2 Gephi fails to import Neo4j 2.0.1 database with trunk built Neo4j plugin

I checked the GitHub project for Gephi's Neo4j plugins. They supposedly upgraded support for Neo4j 2.0.1 in the trunk. I attempted to build the plugins from source with these steps. I could not successfully import a 2.0.1 Neo4j DB, so I'm unsure if I missed something. Any thoughts on whether the plug-in source is the problem or if my steps are incorrect?
Install JDK 7 (if you have not already).
Ensure that JAVA_HOME environment variable points to the top-level JDK location on your machine.
Install Apache Ant.
Ensure that these 2 path variables for Ant have been set.
a. Add the ANT_HOME environment variable set to C:\ant.
b. Add the ANT_OPTS environment variable set to -Xmx256M.
Download the Neo4j Gephi plug-in source code from GitHub
Cd to your source directory with the Neo4j plug-in code for Gephi. Run this command:
ant clean nbms
The build should be successful. Check the [your Gephi plug-in top-level]\build\updates for the constructed .nbm files.
Follow the manual instructions to install these plugins.
Open Gephi and go to File > Neo4j > Full import. You should be able to view a Neo4j graph database of version 2.0.1.

setting environment variables

I'm setting up grails, and these are the commands the README indicates you should run for a unix machine. My problem is that the echo command doesn't output anything like it should. I double checked and have the grails folder in the right directory.
> set GRAILS_HOME=~/grails
> export GRAILS_HOME
> echo ${GRAILS_HOME}
~/grails
you need to set the path variable:
export GRAILS_HOME=/path/to/grails
export PATH=$PATH:$GRAILS_HOME/bin
For OS X Lion you add these lines this is to your ~/.bash_profile file. This is the same as your /Users/macUsername/.bash_profile. After saving this edit, new terminal windows will have this effect in place. You can also run source ~/.bash_profile to make the change happen in your current terminal window.
On another *nix you would edit a slightly different file.
The .bash_profile file holds commands that run every time you start your terminal.
Installation from Download
Prerequisites
Before you can start using Grails you will need to install a Java SDK (not just a JRE) and set the JAVA_HOME environment variable to the location of that SDK. The minimum required version of the SDK depends on which version of Grails you are using:
Java SDK 1.4+ for Grails 1.0.x and 1.1.x
Java SDK 1.5+ for Grails 1.2 or greater
Steps
Download the latest Grails release
Extract the archive into an appropriate location; typically C:\grails on Windows or ~/grails on Unix
Create a GRAILS_HOME environment variable that points to the path where you extracted the archive (eg C:\grails on Windows or ~/grails on Unix)
If you have not set the JAVA_HOME environment variable yet, create JAVA_HOME environment variable that points to the path where you have installed Java
Append a reference to the "bin" directory within the Grails directory to your PATH variable (eg %GRAILS_HOME%\bin on Windows or $GRAILS_HOME/bin on Unix). Note that, for Windows, both PATH and GRAILS_HOME must be defined at the same environment variable level (eg. 'System variables') rather than across environment variable levels (eg. PATH under 'System variables' and GRAILS_HOME under 'User variables')
Type "grails" at the command line, if a help message is displayed you are ready to start using Grails!
If you get an error message, try to chmod +x the grails script inside the bin directory.
Installation from Git (The Version Control Repository)
Prerequisites
In order to start using Grails from Git you need to have the following:
An installation of Java 1.5 or higher and have set your JAVA_HOME variable to the install location
A Git client
Steps
Check out Grails from the Git repository
by running: git clone git://github.com/grails/grails-core.git
Set the GRAILS_HOME environment variable to CHECKOUT_LOCATION/grails-core
Add the $GRAILS_HOME/bin directory to your PATH environment variable
What happens next depends on which branch you are working on.
For the 2.0.x and the 'master' branch:
Go to the GRAILS_HOME directory and run: ./gradlew install
That's it! You can now start developing in Grails using your custom copy of Grails!
For the 1.3.x branch:
Go to the GRAILS_HOME directory and run: ./gradlew libs
Then from the GRAILS_HOME directory run: ./gradlew install
That's it! You can now start developing in Grails using your custom copy of Grails!
For the 1.2.x branch:
If you don't have Ant 1.7 (or later) installed, you will need to
set ANT_HOME to $GRAILS_HOME/ant
add $ANT_HOME/bin to your PATH environment variable
you may need to give the scripts in $ANT_HOME/bin execute permissions
Increase the java memory to 1024M by setting ANT_OPTS=-Xmx1024M
Go to the GRAILS_HOME directory and type ant jar to build Grails
That's it! You can now start developing in Grails using your custom copy of Grails!
Confirm your grails install by grails -version

Installing Ant on Cygwin

I'm having some trouble figuring out how to install Ant on Cygwin. I want to use Ant to build Nutch. I've looked through a bunch of tutorials but I can't find anything that is low level enough for me to understand. I need something like...
Download ant, put it here
Open Cygwin
type "export ANT_HOME=..."
...
Can anyone help me out here?
Assuming you have a JDK already installed, you can do this:
$ export ANT_HOME=/cygdrive/c/apache-ant-1.7.1
which assumes you've unzipped Ant into C:\apache-ant-1.7.1. Then:
$ export PATH=$ANT_HOME/bin:$PATH
$ ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
In Windows, add the path to your ant /bin directory to the Path system variable. This can easily be done by right clicking on Computer > Properties > Advanced System Settings > Environment Variables, click on Path in the System Variables, click on Edit and add ; followed by the path to your ant bin directory to the end of the Variable value.
Start or restart Cygwin.
Type ant -version The version should be displayed.
Here's a step-by-step guide:
simply download and unzip ANT binaries say into c:\apache-ant-1.8.1
download and unzip NUTCH sources say into: c:\apache-nutch-1.2
open the command prompt and run the following:
cd c:\apache-nutch-1.2
c:\apache-ant-1.8.1\bin\ant
the same would work from the Bash shell, just use Cygwin-style paths:
cd /cygdrive/c/apache-nutch-1.2
./cygdrive/c/apache-ant-1.8.1/bin/ant
That's it, you will find a new directory build containing the output.
For convenience, you might want to add the Ant bin directory to the PATH environment variable so that you don't have to give the full path each time, but that's optional.
BTW I just did those exact steps, and all went fine.
Finally, follow this tutorial to get started.

Resources