Add PrimeFaces dependencies with Maven

Repository:

<id>prime-repo</id>  
  <name>PrimeFaces Maven Repository</name>  
  <url>http://repository.primefaces.org</url>  
  <layout>default</layout>  
</repository>

Dependencies:

<dependency>
  <groupId>org.primefaces</groupId>
  <artifactId>primefaces</artifactId>
  <version>3.5</version>
  <type>jar</type>
</dependency>
 
<dependency>
  <groupId>commons-fileupload</groupId>
  <artifactId>commons-fileupload</artifactId>
  <version>1.3</version>
  <type>jar</type>
</dependency>

Where does Maven store the dependencies?

Last time I declared this Maven dependency in my pom.xml:

<dependency>
  <groupId>com.tinkerpop.blueprints</groupId>
  <artifactId>blueprints-core</artifactId>
  <version>1.2</version>
</dependency>

I then requested the download of this dependency and got blueprints-core-1.2.jar. But where has this dependency been saved? I then found out that the dependencies are saved to the user’s Maven home directory (e.g. C:\Users\bennyn\.m2).

Finally I found the file here:
C:\Users\bennyn\.m2\repository\com\tinkerpop\blueprints\blueprints-core\1.2\blueprints-core-1.2.jar

You can also specify the location yourself. To do that, you just have to change the Maven local repository in the settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>C:\dev\temp</localRepository>
  ...
</settings>

Eigene JAR-Bibliothek in Maven-Projekt verwenden

Apache Maven ist wundervoll. Aber wie bekommt man die eigene JAR-Bibliothek als Maven-Abhängigkeit in sein Projekt? Das geht einfacher als gedacht. Man muss dazu nur folgendes in die Konsole eingeben:

mvn install:install-file -Dfile=C:\path\to\my-lib-0.1.jar -DgroupId=com.mycompany.mylib -DartifactId=MyLibrary -Dversion=0.1 -Dpackaging=jar

Danach kann man in der pom.xml von seinem Maven-Projekt die eigene Bibliothek über folgenden Eintrag einhängen:

1
2
3
4
5
6
7
...
    <dependency>
      <groupId>com.mycompany.mylib</groupId>
      <artifactId>MyLibrary</artifactId>
      <version>0.1</version>
    </dependency>
...

Vielen Dank an How to include library manually into maven local repository?.