Maven依赖不在primefaces工作? [英] Maven depedency not working in primefaces?

查看:132
本文介绍了Maven依赖不在primefaces工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在primefcaes中显示条形码。为此我创建了一个基于maven的项目&为这些图书馆添加了两个依赖项,例如

I wanted to show the barcode in primefcaes.For that i created a maven based project & added two dependency for those 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>

我在primefaces文档中读到barcode4j-2.1可能在maven中不可用所以我需要在maven repo中手动安装jar

I read in primefaces documentation that barcode4j-2.1 may not be available in maven so i need to manual install the jar in maven repo

我已经在eclipse中使用此命令将jar安装到maven repo中

I have installed the jar into 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>

但如果我添加barcode4j-light-2.1 jar文件,我看不到任何条形码生成在 lib 文件夹中,我能够生成条形码,但不能生成QR码,但现在我无法生成条形码。

But i can't see any barcode generated if i was adding the barcode4j-light-2.1 jar file in lib folder then i was able to generate bar code but not the QR code but now i can't generate not even barcode.

I当我将jar文件安装到maven repo时,在eclipse控制台上获得以下输出。

I get the following output on eclipse console when i install the jar file into maven repo.

对于qrgen jar


for barcode4j

推荐答案

查看您的依赖项和安装内容的groupId和artifactId:

Look at the groupId and artifactId's for your dependencies and what you installed:

qrgen:       -DgroupId=net.glxn.qrgen -DartifactId=qrgen
qrgen-light: -DgroupId=net.glxn.qrgen -DartifactId=qrgen

您的依赖项显示不同的组/ artifactId:

Your dependencies show a different 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>

您手动将罐子安装到名为 net /的maven仓库中的目录glxn / qrgen / qrgen 但你的依赖关系期望在 net / glxn / qrgen net / sf /中找到它们barcode4j / barcode4j-light 分别。

You manually installed your jars to a directory in the maven repo called net/glxn/qrgen/qrgen but your dependencies are expecting to find them in net/glxn/qrgen and net/sf/barcode4j/barcode4j-light respectively.

您需要将手动安装命令更新为:

You need to update your manual install commands to:

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=1.4 -Dpackaging=jar

这篇关于Maven依赖不在primefaces工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆