run.sh - 包 X 不存在

run.sh - package X does not exist

我是 运行 ./run.sh 来自 Alfresco All-in-One 扩展,但我收到错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project repo-amp: Compilation failure: Compilation failure:

[ERROR] /home/user/signextension/sign/repo-amp/src/main/java/pt/empt/sign/fields/CreateFields.java:[3,25] package com.itextpdf.text does not exist

[ERROR] /home/user/signextension/sign/repo-amp/src/main/java/pt/empt/sign/fields/CreateFields.java:[4,25] package com.itextpdf.text does not exist

[ERROR] /home/user/signextension/sign/repo-amp/src/main/java/pt/empt/sign/fields/CreateFields.java:[5,1] package com.itextpdf.text.pdf does not exist

我的run.sh:

#!/bin/bash
# Downloads the spring-loaded lib if not existing and runs the full all-in-one
# (Alfresco + Share + Solr) using the runner project
springloadedfile=~/.m2/repository/org/springframework/springloaded/1.2.3.RELEASE/springloaded-1.2.3.RELEASE.jar

if [ ! -f $springloadedfile ]; then
mvn validate -Psetup
fi
MAVEN_OPTS="-javaagent:$springloadedfile -noverify -Xms256m -Xmx2G" mvn clean install -Prun

我试试这个:

#!/bin/bash
# Downloads the spring-loaded lib if not existing and runs the full all-in-one
# (Alfresco + Share + Solr) using the runner project
springloadedfile=~/.m2/repository/org/springframework/springloaded/1.2.3.RELEASE/springloaded-1.2.3.RELEASE.jar
itextpdffile=~/.m2/repository/com/itextpdf/itextpdf/5.5.7/itextpdf-5.5.7.jar

if [ ! -f $springloadedfile ] && [ ! -f $itextpdffile ]; then
mvn validate -Psetup
fi
MAVEN_OPTS="-javaagent:$springloadedfile -javaagent:$itextpdffile -noverify -Xms256m -Xmx2G" mvn clean install -Prun

但是我得到了错误:

Failed to find Premain-Class manifest attribute in /home/user/.m2/repository/com/itextpdf/itextpdf/5.5.7/itextpdf-5.5.7.jar Error occurred during initialization of VM agent library failed to init: instrument

有解决这个问题的帮助吗?

itext 库不是 javaagent 库,请查看 this link 以了解有关 java agent 的更多信息以及它们的用途!

向项目添加 itext 依赖项的正确方法是添加此代码段:

<dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>itextpdf</artifactId>
    <version>5.5.7</version>
</dependency>

到你的主 pom.xml 文件(或者 repo-amp pom.xml 或者)(在依赖项部分)。当然,回滚您对 run.sh 文件所做的任何更改!