SapJco 3.0.11 with Maven: It is not allowed to rename or repackage the original archive “sapjco3.jar”

后端 未结 1 637
轮回少年
轮回少年 2021-01-13 11:54

The current version of the sap jco connector enforces the name of the containing jar at runtime. This will lead to exceptions, if it doesn\'t match the name (sapjco3.jar). <

1条回答
  •  南笙
    南笙 (楼主)
    2021-01-13 12:30

    I had the same issue, and below is how I fixed it (in short work around it): 1. Run the command in command prompt

    mvn install:install-file 
    -Dfile=sapjco3.jar 
    -DgroupId=com.company.sap 
    -DartifactId=com.sap.conn.jco.sapjco 
    -Dversion=1.0 
    -Dpackaging=jar
    
    1. This will create a local artifact, or you can also create it in remote repository
    2. Download this dependency from maven as shown below:

      com.company.sap com.sap.conn.jco.sapjco 1.0

    This work around would avoid the sapjco3 error:

    if (!jarname.equals("sapjco3.jar") 
    && !jarname.startsWith("com.sap.conn.jco") 
    && !jarname.equals("sapjco3_IDE.jar") 
    && Package.getPackage("org.apache.maven.surefire.booter") == null 
    && Package.getPackage("org.eclipse.jdt.internal.junit.runner") == null) {
        throw new ExceptionInInitializerError("Illegal JCo archive \"" + jarname + "\". It is not allowed to rename or repackage the original archive \"" + "sapjco3.jar" + "\".");
    }
    

    0 讨论(0)
提交回复
热议问题