Showing posts with label maven. Show all posts
Showing posts with label maven. Show all posts

Monday, May 11, 2015

Could not reserve enough space for object heap

Here is the errors during the Maven build:

Error occurred during initialization of VM 
Could not reserve enough space for object heap 
Error: Could not create the Java Virtual Machine. 
Error: A fatal exception has occurred. Program will exit. 
Picked up _JAVA_OPTIONS: -Duser.home=C:\Users\Andre

In order to fix this, add an extra parameter to _JAVA_OPTIONS sys environment:
-Xmx512m

So it should look something like this:
_JAVA_OPTIONS: -Duser.home=C:\Users\Andre -Xmx512m

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.

Sunday, February 1, 2015

How to install Maven on Ubuntu Linux

Do it from terminal:
sudo apt-get update
sudo apt-get install maven

Monday, January 5, 2015

Create GXT 3 project example

Here is the way you could create GXT 3 project.
You would use Maven Archetype with a little workaround of pom.xml and code.

Form CLI execute:

mvn archetype:generate    -DarchetypeGroupId=org.codehaus.mojo    -DarchetypeArtifactId=gwt-maven-plugin    -DarchetypeVersion=2.7.0

Then:

mvn gwt:verify
mvn gwt:run

At this point you will be able to run pure GWT demo.

Now is the GXT time:

In root html file add following line as the first stylesheet
<link rel="stylesheet" type="text/css" href="MyModule/reset.css">

Remove the table for the Web Application Starter project. We don’t need it for this guide.

Add the line below to the *.gwt.xml
<inherits name="com.sencha.gxt.ui.GXT" />
And remove the following line from the same file:
<inherits name="com.google.gwt.user.theme.standard.Standard" />
Inside of the main root class that implements EntryPoint leave only this:
public void onModuleLoad() {
    BasicTabExample tabs = new BasicTabExample();
    RootPanel.get().add(tabs);
}


Create in the same package of the root class this class:

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.

Wednesday, November 13, 2013

Run Android project generated by Maven archetype:generate from IDE by Maven commands

When you create an Android project by Maven e.g. mvn archetype:generate your new Project will be presented in IDE as a Java project, not the Android's one. So you can't run it from IDE as an Android project "out of the box". You should use Maven commands instead:

mvm android:deploy
mvm android:run

By default Maven will deploy your apk on all available deviсes including USB's ones and emulator. So if you want to use only USB devices change related setting in pom.xml of the project.

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.

Thursday, April 19, 2012

How to run GWT test with Maven

If you want to run just one test do this:

1. Go to the module where your tests live. In my case it is here:

MBPro-2:ui-common apple$ pwd
/Users/apple/Documents/workspace/svn/TRT-1##9/t0-mvn/ui-common
MBPro-2:ui-common apple$ 


2. Then run the test
mvn -Dtest=HostlistExprTestGWT test

HostlistExprTestGWT is the name of the test without its extension.

Friday, January 27, 2012

Maven Repository site with dependencies for Pom.xml

You could find the dependency you need for your Maven pom.xml on this site:
http://mvnrepository.com

Just enter in search field of Home page the library or jar you need and then you will get the list of links you can choose.


Friday, November 11, 2011

How to use Eclipse plugin for Maven

Read this post:
http://googlewebtoolkit.blogspot.com/2010/08/how-to-use-google-plugin-for-eclipse.html

Tuesday, October 25, 2011

eclipse error unbound classpath variable m2_repo

Everything was great until I changed workspace in Eclipse for other directory. When I opened th project I've got a bunche of errors "unbound classpath variable m2_repo". In this case do this:

1. Go to Preferences/Java/Build PAth/Classpath Variables
2. If there is no such variable as M2_REPO - add it (press New...)
3. Ussually a correct path for this variable is ${user.home}/.m2/repository

That's all.

Wednesday, September 28, 2011

How to set MAKE command on Mac

Actually, the MAKE command should be already installed on your Mac if you have Xcode installed. But in my case MAKE have been disappeared after update from Snow Leopard to Lion OSX. By some reason PATH to MAKE was changed. So what you need to do in this case in order to make MAKE available - fix PATH e.g:

Apples-MacBook-Pro:t0-mvn apple$ make
-bash: make: command not found
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/
.DS_Store                    Documentation/               Icon^M                       SDKs/
About Xcode and iOS SDK.pdf  Examples/                    Library/                     Tools/
About Xcode.pdf              Extras/                      Makefiles/                   usr/
Applications/                Headers/                     Platforms/                   
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/usr/
X11/          etc/          lib/          llvm-gcc-4.2/ sbin/         
bin/          include/      libexec/      local/        share/        
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/usr/bin/
Display all 173 possibilities? (y or n)
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/usr/bin/ma
make            malloc_history  mapc            
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/usr/bin/make 
/Developer/usr/bin/make
Apples-MacBook-Pro:t0-mvn apple$  /Developer/usr/bin/make 
make: *** No targets specified and no makefile found.  Stop.
Apples-MacBook-Pro:t0-mvn apple$ export PATH=$PATH:/Developer/usr/bin/
Apples-MacBook-Pro:t0-mvn apple$ make
make: *** No targets specified and no makefile found.  Stop.


Then you probably will want to change your PATH variable in your profile configuration. Do this:


$ vi ~/.profile


////
export PATH=/opt/subversion/bin:$PATH:/Developer/usr/bin

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: