Can mvn install packages globally (e.g. command line tools like nutch)? - java

Command line tools written in Ruby can be installed through RubyGems. Command line tools written in Node.js can be installed through NPM.
Does mvn offer similar functionality, or should I look to package systems like apt-get for installing Java command line tools?

Related

OpenJDK JDK11 not having JMC- Java Mission Controller- FlightRecorder

I was hoping JMC would be available with OpenJDK, JDK11 binaries as this has been opensourced from Java 11 by oracle, but could not locate this in Oracle and AdoptOpenJDK Java-11 binaries under bin folder.
I have also tried this https://jdk.java.net/jmc/ as some article said its being releases separately.
Does anyone know how to get JMC for OpenJDK-11.
I am editing this answer since builds are now available, and have been available, from multiple vendors for quite some time. The list is available in the readme for the JMC GitHub repo:
https://github.com/openjdk/jmc
Don't forget to give the project a star if you like it! :)
Here is the original answer:
Normally the builds will be available here:
https://jdk.java.net/jmc/
See http://hirt.se/blog/?p=1007 for more information on the new delivery format.
The builds have been (temporarily) pulled because a switch from the old javax.mail coordinates to the new coordinates at jakarta-ee has not yet gotten the proper third-party approval. A new build, with plenty of fixes and with all the approvals properly in place (or a revert of the change), should be along within the next few weeks.
Up until then it is possible (also not hard) to build JMC 7, by pulling the official JMC repo from here:
https://hg.openjdk.java.net/jmc/jmc7/
You can also build and pull the mainline mirror from the inofficial GitHub repo:
https://github.com/JDKMissionControl/jmc
For more information on building JMC, see:
http://hirt.se/blog/?p=947 (or simply read the README.md in the repository root)
Good luck!
Since Java11, JMC is not part of the JDK any more. It is a separate project, as you already noticed.
https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html
Azul provides free, unsupported builds of Zulu Mission Control available for download at http://azul.com/products/zulu-mission-control
Builds are available for clients running Windows, Linux, and Mac OS X.
There are now binaries produced by Oracle as well:
https://jdk.java.net/jmc/
I believe they're still evaluating GitHub to moving to an independent repository with current progress being still under jmc7.
You can currently download standalone versions from Oracle's website for mission-control.
BellSoft provides Liberica Mission Control: https://bell-sw.com/pages/lmc/
As per their documentation, it's free to use in production environments, and there is a commercial support included as part of Support Subscription for Liberica JDK.
Update
JMC 8 available when compiling it from source. Here is a single command for linux users to build your own copy of jmc
mkdir ~/jmcToDelete && \
cd ~/jmcToDelete && \
git clone https://github.com/openjdk/jmc.git && \
cd jmc/releng/third-party && \
mvn p2:site && \
runJetty="mvn jetty:run" && \
bash -c "$runJetty &" && \
cd ~/jmcToDelete/jmc/core && \
mvn clean install && \
cd ~/jmcToDelete/jmc && \
mvn package -Dmaven.test.skip=true && \
kill $(jps | grep Launcher | awk '{print $1}') && \
sudo mkdir -p /opt/java/jmc && \
sudo tar xzf $(find ~/jmcToDelete/jmc/target -name '*.jmc-linux*') -C /opt/java/jmc && \
sudo ln -s /opt/java/jmc/jmc /usr/local/bin/jmc && \
rm -rf ~/jmcToDelete
typing jmc in a terminal should start it.
Outdated
As stated by Hirt you can compile it from http://hg.openjdk.java.net/jmc
The jmc available in jdk8 (v5.5) requires the special flags -XX:+UnlockCommercialFeatures -XX:+FlightRecorder to be present in the JVM process and it will not retrieve "flight records" if they are not there, so you can only use it with java1.8. If you would like to add those flags on openjdk-11 it will fail with Unrecognized VM option 'UnlockCommercialFeatures' meaning that you don't need them as they are enabled by default ( FlightRecorder ).
I compiled jmc-7.1.0 without issues by downloading the gz archive from http://hg.openjdk.java.net/jmc/jmc/
Follow the steps present in the README file:
Make sure the compilation is done with jdk1.8
In one terminal :
cd releng/third-party
mvn p2:site
mvn jetty:run
And in the second terminal:
cd core
mvn clean install
cd ..
mvn package
On completion you should have all your artefacts in the target folder.
The default jmc start script has a lot of flags present and it will not start with all of them, hence you can start the intended jar using
java -jar ./jmc-[...]/target/products/jmc/plugins/org.eclipse.equinox.launcher_[...].jar

Why there are two java path in my PC when i use the "mvn -v"

When I use mvn spring-boot:run to run a Spring Boot project, I find if use the command in Cmd, it works. but if I use it in Git Bash, it can't work.
So I use java -version and mvn -v to view the Java and maven version.
java -version give me the same result, but mvn -v result is different, as the picture shows:
And when I see my java path, I'm sure it's C:\Program Files\Java\jdk1.8.0_151
So I want to know, why there are two Java paths in my PC when I use mvn -v?
Both the java executable and Maven by default use the JDK that is specified in the $JAVA_HOME environment variable.
You are executing java and Maven (mvn) in different environments (cmd.exe in one case and Git Bash in the other case), so the most likely explanation is that $JAVA_HOME is set to different JDKs in the respective environments.
You can check the content of $JAVA_HOME with echo $JAVA_HOME.

How to mvndebug in fedora

I have a problem, i need to debug a maven project using the mvndebug in fedora Linux, but the terminal does not recognize the mvndebug command.
Fedora's command line is case sensitive, and I believe the command is mvnDebug, with a capital D. Try that.
Does mvn work? If not, you need to sudo yum install maven2 to install it.
The maven debug tool is installed as part of maven's package (yum install maven). Note, however, it's called mvnDebug, with a capital D.

Trunk doesn't compile because libprotoc is old when working with Hadoop under Eclipse

I am following "working with Hadoop under Eclipse" and trying to run
$ mvn install -DskipTests
After a while, I received an error:
[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: protoc version is 'libprotoc 2.4.1', expected version is '2.5.0' -> [Help 1]
It is the same as what is reported in this page.
Does anyone know how to solve it? How should I do to upgrade libprotoc?
Protocol Buffers is used as an RPC protocol between different daemons. Some of the Linux releases don't have the required version. So, Protocol Buffers code has to be downloaded from here, built and installed. These are the instructions from the README.txt in the downloaded bundle.
To build and install the C++ Protocol Buffer runtime and the Protocol Buffer compiler (protoc) execute the following:
$ ./configure
$ make
$ make check
$ make install
If "make check" fails, you can still install, but it is likely that some features of this library will not work correctly on your system. Proceed at your own risk. "make install" may require superuser privileges.
Execute this bash function, which will download protobuffer 2.5.0 and install with sudo permission. (Tested in ubuntu 13.04)
configureProtoc(){
sudo apt-get install -y gcc g++ make maven cmake zlib zlib1g-dev libcurl4-openssl-dev
curl -# -O https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
gunzip protobuf-2.5.0.tar.gz
tar -xvf protobuf-2.5.0.tar
cd protobuf-2.5.0
./configure --prefix=/usr
make
sudo make install
}
Dont forget to link shared libraries after installing protoc :
ldconfig

Install ANT (and JAVA) on server

I am trying to install ANT (to build/compile Android apps) on a local Linux (Ubuntu) installation so that I can install it on a live server (work out the kinks first).
The following is a set of commands I have run to get to where I am:
wget http://archive.apache.org/dist/ant/ant-current-src.zip /dest/folder
unzip ant-current-src.zip
wget http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-x64.bin /dest/folder
./jdk-6u25-linux-x64.bin
(backup PATH :P )
export JAVA_HOME=jdk1.6.0_25 export
PATH=$PATH:jdk1.6.0_25/bin
wget http://voxel.dl.sourceforge.net/project/junit/junit/4.10/junit-4.10.jar
cp junit-4.10.jar junit.jar
rm junit-4.10.jar
export CLASSPATH=$CLASSPATH:$JUNIT_HOME
With the following screenshot showing the output of the terminal:
At this point I'm stumped...
RESOURCES:
http://ant.apache.org/manual/index.html -> Installing Apache Ant -> Building Ant
You do not need to build ant to use and you can just install Java and Ant from the ubuntu packages.
sudo apt-get install ant
should install Java and ant for you.

Categories

Resources