Saturday 28 May 2011

Add custom repository to maven and add a library (dependency) from this repository

If you add a dependency to your project's pom.xml file, everytime when you try to build your project maven tries to connect to maven's default libraries (http://repo1.maven.com ...) and returns with a error message which says it could not find source in maven default repositories. So: lets see how can you add your custom repositories to maven and dependencies to your projects.

Scenario: there is that myLib-200.jar with a groupId which is 'aliolcicode' under the http://repo.aliolci.com

1. You have to add that custom repository to your maven settings to inform maven that 'I use my custom repositories next to maven repositories'. To do this. open your maven settings file (click here to see how) and add these lines below, between 'mirrors' tags
in XML above the important part is the url part the others are definition of your custom repository.
<mirror>
<id>aliolci</id>
<name>aliolci code repository</name>
<url>http://repo.aliolci.com</url>
<mirrorof>*</mirrorof>
</mirror>
2. Add your dependency to your project. There is nothing special about this. Just add your dependency as usual into your projects pom.xml.
<dependencies>
<dependency>
<groupid>aliolcicode</groupid>
<artifactid>myLib</artifactid>
<version>200</version>
</dependency>
</dependencies>
That's it. Enjoy!

Saturday 21 May 2011

Intellij IDEA is freezing during Maven project (pom.xml file) reimporting

There is a stupid bug for the maven projects at the intellij which is a conflict of pom.xml and and Intellij project files (.iml, .ipr, .iws). To solve this conflict, just delete these all IntelliJ project files. Then open and reimport project just over the pom.xml. IntelliJ will create all project files from the begining.

Thursday 5 May 2011

Maven settings.xml location at Ubuntu and Windows Systems

settings.xml file is used for configuring maven builder about profiles, repositories etc. At windows systems this file can be found at;

{Maven Installed Location}\conf\settings.xml
such as: C:\Program Files (x86)\Apache Software Foundation\apache-maven-3.0.3\conf

At Ubuntu systems it can be found under

/etc/maven2/settings.xml

Sunday 1 May 2011

Ubuntu 11.04 set a new environment variable (persistently)

Custom environment variables are stored in /etc/environment file.

sudo gedit /etc/environment

If you open this file you will see the PATH variable's value. If you would like to set a new one just move to new line and set your variable in {variable_name}="{variable_value}" format. Such as JAVA_HOME="/usr/lib/jvm/java-6-sun/bin"

DONT FORGET TO OPEN FILE AS SUPER USER and restart your computer after you saved the changes.

To see the list of environment variables:
bash$ export