Understand optional true in maven dependency

Today one colleague  from the other team was trying to mimic our behavior doing custom authentication on Hive-Server2. He asked me why he could not get the HiveConf.get(key) working. It basically gets the key we defined in hive-site.xml. It is convenient because if we put key/value there, we do not have to worry about path issue…

exclude xml-apis dependency in maven

The xml-apis version 1.0xxx is referenced by multiple hibernate artifacts like hibernate-core, hibernate-entitymanager etc. It is annoying because it would conflict with the JRE’s own javax.xml api in the rt.jar which would cause problems like xml cannot parse. We need to be extra careful about it since it usually is introduced thru transitive dependencies. Definitely…

version compress css js with maven

One problem in release is the user still caches our resources that our new look/feel can not be presented unless user hard refresh the browser. To overcome this, several ways: 1. append a query string(like UUID) to the resource This is good if you want to user download a fresh copy each request. If we randomize…

maven build phase plugine(clover duplicate class)

When using clover2 in CI build, it might throw duplicate class error if using: mvn clover2:setup test clover2:aggregate clover2:clover. The reason is the clover2:setup is by default in the generate-source phase will copy the src to target/clover/src-instrumented and the test will also run the generate source and compile. Now there end up to be 2 source and…

switch min.js from development to production

we usually need the full js for development purpose, but the min.js for production. same thing applies to CSS. The way we are using is thru maven-replacer-plugin replacer plugin config: The phase here need to the prepare-package. If you use package, the build will pass BUT only the file in the exploded will be replaced,…

setup java home java8 and mvn in yosemite

1. download and install java 8. 2. download and extract maven 3. create a .bash_profile under ~ (Users/yourname) if you do not have such a file (use ls -a to view all files including hidden ones). This file contains the options when you start your terminal. 4.  find your java_home first: Java 7 and Java…

maven override execution in profile

  You can set the <phase> of the corresponding execution to something unknown, like none:  <phase>none</phase> when overriding each execution. 

maven jgoodies intellij NullPointerException

Jgoodies is a good and quick tool for build Swing application. I have no problem using it and running it inside Intellij. Also if I use Intellij’s build in way to build the Jar, no problem. However when I was trying to use maven to build this executable jar, problem comes. it looks like the…

maven exclusions and optional

Optional: The default value for optional in dependency tag is false. This way, all sub project will inherit this dependency If set to be true, we need to explicitly specify the dependency in sub project, just like what we do for dependencyManagement. Exclusions: if X need A, A need B. We can specify the exclusion so that…

dependencymanagement and dependencies in maven

Dependency Management allows to consolidate and centralize the management of dependency versions without adding dependencies which are inherited by all children. This is especially useful when you havea set of projects (i.e. more than one) that inherits a common parent. Another extremely important use case of dependencyManagement is the control of versions of artifacts used in transitive dependencies. We…

maven create executable jar with dependency

was trying to use intellij built in jar builder with my standalone executable jar. but seems something wrong with it. Had to use mvn for it . below are the steps: Herewe use maven-shade-plugin, in Pom.xml: run : mvn clean package we can get the jar file in the target folder. The Manifest.MF file specifies the…