Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何将依赖项包含到JAR文件(Maven)_Java_Eclipse_Spring Boot_Maven_Pom.xml - Fatal编程技术网

Java 如何将依赖项包含到JAR文件(Maven)

Java 如何将依赖项包含到JAR文件(Maven),java,eclipse,spring-boot,maven,pom.xml,Java,Eclipse,Spring Boot,Maven,Pom.xml,我已经尝试了我在这里遇到的与这个主题相关的所有解决方案,但我仍然无法找到解决方案 在Eclipse(SpringBoot+Maven)中运行我的项目时,一切运行都很顺利。我能够从API调用中看到一些JSON数据。我的目标是在CloudFoundry上部署这个项目,但我经常得到ClassNotFoundError(Java)。下面是我的POM文件 我曾尝试将其导出为可运行的JAR,并通过命令行运行该JAR,但也遇到了NoClassFound错误 <?xml version="1.0

我已经尝试了我在这里遇到的与这个主题相关的所有解决方案,但我仍然无法找到解决方案

在Eclipse(SpringBoot+Maven)中运行我的项目时,一切运行都很顺利。我能够从API调用中看到一些JSON数据。我的目标是在CloudFoundry上部署这个项目,但我经常得到ClassNotFoundError(Java)。下面是我的POM文件

我曾尝试将其导出为可运行的JAR,并通过命令行运行该JAR,但也遇到了NoClassFound错误

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.intel</groupId>
    <artifactId>EDM</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>EDM</name>
    <description>EDM Library</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web-services</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        
<!-- Mentor Dependencies -->
        
        <dependency>
            <groupId>com.mentor.datafusion.oi</groupId>
            <artifactId>com.mentor.datafusion.oi</artifactId>
            <version>1.0.0</version>
        </dependency>
        
        <dependency>
            <groupId>com.mentor.dms.ui</groupId>
            <artifactId>com.mentor.dms.ui</artifactId>
            <version>1.0.0</version>
        </dependency>        
       
        <dependency>
            <groupId>com.mentor.dms.xml.importexport</groupId>
            <artifactId>com.mentor.dms.xml.importexport</artifactId>
            <version>1.0.0</version>
        </dependency>
        
        <dependency>
            <groupId>dfo</groupId>
            <artifactId>dfo</artifactId>
            <version>1.0.0</version>
        </dependency>        

        <dependency>
            <groupId>dfutils</groupId>
            <artifactId>dfutils</artifactId>
            <version>1.0.0</version>
        </dependency>    

        <dependency>
            <groupId>com.mentor.datafusion.dfo.is3</groupId>
            <artifactId>com.mentor.datafusion.dfo.is3</artifactId>
            <version>1.0.0</version>
        </dependency>
                  

        <dependency>
            <groupId>com.mentor.is3.edm.login.api</groupId>
            <artifactId>com.mentor.is3.edm.login.api</artifactId>
            <version>1.0.0</version>
        </dependency>
        
        <dependency>
            <groupId>com.mentor.datafusion.dfo.is3.api</groupId>
            <artifactId>com.mentor.datafusion.dfo.is3.api</artifactId>
            <version>1.0.0</version>
        </dependency>        
        
        <dependency>
            <groupId>apache-logging-log4j</groupId>
            <artifactId>apache-logging-log4j</artifactId>
            <version>1.0.0</version>
        </dependency>  
        
           
    </dependencies>
    

    <build>
        <plugins>
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>repackage</goal>
              </goals>
              <configuration>
                <classifier>spring-boot</classifier>
                <mainClass>com.intel.EDM.EdmApplication</mainClass>
              </configuration>
            </execution>
          </executions>
          </plugin>
        </plugins>
    </build>

</project>


4.0.0
org.springframework.boot
spring启动程序父级
2.4.5
com.intel
电火花加工
0.0.1-快照
电火花加工
EDM库
11
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
spring启动程序日志记录
org.springframework.boot
SpringBootStarterWeb服务
org.springframework.boot
弹簧起动试验
测试
com.mentor.datafusion.oi
com.mentor.datafusion.oi
1.0.0
com.mentor.dms.ui
com.mentor.dms.ui
1.0.0
com.mentor.dms.xml.importexport
com.mentor.dms.xml.importexport
1.0.0
dfo
dfo
1.0.0
德富提尔
德富提尔
1.0.0
com.mentor.datafusion.dfo.is3
com.mentor.datafusion.dfo.is3
1.0.0
com.mentor.is3.edm.login.api
com.mentor.is3.edm.login.api
1.0.0
com.mentor.datafusion.dfo.is3.api
com.mentor.datafusion.dfo.is3.api
1.0.0
apache-logging-log4j
apache-logging-log4j
1.0.0
org.springframework.boot
springbootmaven插件
重新包装
弹簧靴
com.intel.EDM.EDM应用程序

我想你想要。也许吧。祝你好运谢谢,我尝试了maven shade插件,之后,我仍然收到相同的错误“java.lang.ClassNotFoundException:com.mentor.datafusion.dfo.is3.common.dynhandlers.AbstractIS3XDLicenseHandler”你也尝试了maven汇编插件吗?是的,但一旦我尝试运行jar文件,就会出现以下错误;在META-INF/spring.factories中找不到自动配置类。如果您使用的是自定义打包,请确保该文件正确无误。