Maven Dependency not working on networks?
I wanted to show a barcode in firstfcaes. For this I created a maven based project and added two dependencies for these libararies such as
<dependency>
<groupId>net.glxn</groupId>
<artifactId>qrgen</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j-light</artifactId>
<version>2.1</version>
</dependency>
I read in the interfaces documentation that barcode4j-2.1 may not be available in maven, so I need manual install the jar in maven repo
I have installed jar in maven repo using this command in eclipse
install:install-file -Dfile=D:\qrgen-1.4.jar -DgroupId=net.glxn -DartifactId=qrgen -Dversion=1.4 -Dpackaging=jar
install:install-file -Dfile=D:\barcode4j-light-2.1.jar -DgroupId=net.sf.barcode4j -DartifactId=barcode4j-light -Dversion=2.1 -Dpackaging=jar
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.prime</groupId>
<artifactId>primedemop</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>primefaces</name>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>net.glxn</groupId>
<artifactId>qrgen</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j-light</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
</project>
But I don't see any barcode, if I added the jar file barcode4j-light-2.1 to the lib folder then I was able to generate a barcode but not a QRcode, but now I cannot even generate a barcode.
I get the following output in the eclipse console when I install the jar file in the maven repo.
For qrgen jar
for barcode4j
source to share
Have a look at the groupId and artifactId for your dependencies and what you installed:
qrgen: -DgroupId=net.glxn.qrgen -DartifactId=qrgen
qrgen-light: -DgroupId=net.glxn.qrgen -DartifactId=qrgen
Your dependencies show another group / artifactId:
<dependency>
<groupId>net.glxn</groupId> <--- here
<artifactId>qrgen</artifactId> <--- here
<version>1.4</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId> <--- here
<artifactId>barcode4j-light</artifactId> <--- here
<version>2.1</version>
</dependency>
You have manually set your jars to a directory in the maven repo called net/glxn/qrgen/qrgen
, but your dependencies will look for them in net/glxn/qrgen
and net/sf/barcode4j/barcode4j-light
accordingly.
You need to update your installation commands manually:
install:install-file -Dfile=D:\qrgen-1.4.jar -DgroupId=net.glxn -DartifactId=qrgen -Dversion=1.4 -Dpackaging=jar
and
install:install-file -Dfile=D:\barcode4j-light-2.1.jar -DgroupId=net.sf.barcode4j -DartifactId=barcode4j-light -Dversion=1.4 -Dpackaging=jar
source to share