Showing posts with label mvn. Show all posts
Showing posts with label mvn. Show all posts

Monday, May 11, 2015

Issues with user.home during Maven build

If you have issue with incorrect property user.home during Maven build set this sys environment:

_JAVA_OPTIONS=C:\Users\username

More of it here:
http://stackoverflow.com/questions/1501235/change-user-home-system-property

Wednesday, April 22, 2015

Encoding configs of Maven pom.xml in GWT project

<properties>
        <java.version>1.7</java.version>
        <resources.encoding>UTF-8</resources.encoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        ...

Wednesday, April 15, 2015

Enable Maven to get dependency from custom repository by adding settings.xml file into .m2 directory

In order to enable Maven to get dependency from custom repository add settings.xml file into .m2 directory of current user.

Friday, December 13, 2013

Fix Maven Error: JAVA_HOME is not defined correctly on Mac OSX 10.9 Mavericks

If your JAVA_HOME env.variable is set correctly then 100500% 
you have to hardcode the $M2_HOME/bin/mvn script!


Ok. Here is the error massege itself:
Error: JAVA_HOME is not defined correctly. We cannot execute /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java

Now Edit mvn script (it could be line 61):
Change the path of JAVA_HOME that starts with /System/... on your e.g. /Library/...
Change above the value of variable JAVA_VERSION on that you have e.g. jdk1.7_...

Why this issue took place is beacouse the path of JAVA_HOME in OSX 10.9 Maericks is different then it was in previous versions of OS. Before it was installed in /System... now it is in /Library.... BUT the maven script still sets the path of JAVA_HOME that starts in /System... Maybe in next version of Maven this will be changed. 

That's all.

Friday, October 25, 2013

Why maven doesn't downloads source and javadoc files

When you can not see any source code in your IDE such as Eclipse this most probably happen because your Maven (if you do use Maven) does not downloaded source jar file (e.g. filename-source.jar).

Maven does not downloads a source and javadoc jar files by default.

This option should be added to its settings file in ~/.m2/settings.xml file like this:

<profiles>
<profile>
    <id>downloadSources</id>
    <properties>
        <downloadSources>true</downloadSources>
        <downloadJavadocs>true</downloadJavadocs>           
    </properties>
</profile>
</profiles>

<activeProfiles>
  <activeProfile>downloadSources</activeProfile>
</activeProfiles>

Here is the link about this topic:
http://stackoverflow.com/questions/5780758/maven-always-download-sources-and-javadocs

Tuesday, August 14, 2012

Maven (mvn) Exception in thread "main" java. lang. NoClassDefFoundError

It could happen when you try to run mvn or if will just check its version it will give you this kind of error (Exception):


MBPro-2:~ apple$ mvn -version
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

In this case you need just fix symlink to the right version of Maven on your Mac OSX: carefully read and follow all instructions of this article.

Wednesday, June 29, 2011

How to skip tests in maven

Here is the command that excludes tests during mvn package:

mvn -Dmaven.test.skip=true package


or


mvn package -DskipTests


Consult this example from appach site: http://maven.apache.org/plugins/maven-surefire-plugin/examples/skipping-test.html


Monday, May 9, 2011

Install Maven (mvn) on Mac

First of all check version of Maven on your Mac with this command:
mvn --version


MacOS goes with Maven 3.0.2 preinstalled. If you will need mvn 2.2.1 go to this http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-2.2.1-bin.zip 
and download BINARY (!!!) NOT SRC (!!!) file of maven.


Create in ~/usr a new directory local.
Put into ~/usr/local/ this downloaded binary Maven.
Add to ~/.profile this line: 
export PATH=/usr/local/apache-maven-2.2.1/bin:$PATH


IMPORTANT!!! Reboot Mac. Then check again mvn --version and there should be maven 2.2.1.


Here is where to you should to set PATH for JAVA_HOME:


~/.profile


DON'T forget to changes properties of Maven version in IDE!
Here is example where to do it in NetBeans 7: