简体   繁体   English

Maven的虔诚不能在primfaces工作?

[英]Maven depedency not working in primefaces?

I wanted to show the barcode in primefcaes.For that i created a maven based project & added two dependency for those libararies such as 我想在primfcaes中显示条形码。为此,我创建了一个基于maven的项目并为这些库添加了两个依赖项,例如

<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 primefaces documentation that barcode4j-2.1 may not be available in maven so i need to manual install the jar in maven repo 我在primefaces文档中读到了条形码4j-2.1在maven中可能不可用,因此我需要manual install the jar in maven repo

I have installed the jar into maven repo using this command in eclipse 我在Eclipse中使用此命令将罐子安装到了Maven仓库中

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 的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 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. 但是,如果我在lib文件夹中添加条形码4j-light-2.1 jar文件,则看不到任何条形码生成,那么我能够生成条形码,但无法生成QR码,但是现在我什至无法生成条形码。

I get the following output on eclipse console when i install the jar file into maven repo. 当我将jar文件安装到Maven存储库中时,我在Eclipse控制台上得到以下输出。

For qrgen jar 对于qrgen罐

PIC1 for barcode4j 用于条码4j PIC2

Look at the groupId and artifactId's for your dependencies and what you installed: 查看groupId和artifactId的依赖项以及安装的内容:

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

Your dependencies show a different group/artifactId: 您的依赖项显示了另一个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 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. 您已将jar手动安装到Maven存储库中名为net/glxn/qrgen/qrgen的目录中,但是您的依赖项希望分别在net/glxn/qrgennet/sf/barcode4j/barcode4j-light找到它们。

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

and

install:install-file -Dfile=D:\barcode4j-light-2.1.jar -DgroupId=net.sf.barcode4j -DartifactId=barcode4j-light -Dversion=1.4 -Dpackaging=jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM