Java Spring.jar没有启动
当我在IntelliJ中运行我的项目时,它工作正常,服务器启动等。但是当我构建我的项目(使用maven)并希望执行.jar文件时,我会遇到以下错误:Java Spring.jar没有启动,java,spring,maven,spring-boot,Java,Spring,Maven,Spring Boot,当我在IntelliJ中运行我的项目时,它工作正常,服务器启动等。但是当我构建我的项目(使用maven)并希望执行.jar文件时,我会遇到以下错误: > java.lang.IllegalStateException: Cannot load configuration class: > at.ennui.backend.facebook.configuration.SocialConfig > at org.springframework.context.an
> java.lang.IllegalStateException: Cannot load configuration class:
> at.ennui.backend.facebook.configuration.SocialConfig
> at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:403)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:249)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:281)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:125)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
> ~[spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at at.ennui.backend.EnnuiApplication.main(EnnuiApplication.java:12)
> [classes!/:1.0.0-RELEASE]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
> at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_144]
> at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE] Caused by:
> java.lang.IllegalStateException: Unable to load cache item
> at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:79)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:480)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:337)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:138)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:110)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:393)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> ... 20 common frames omitted Caused by: java.lang.NoClassDefFoundError:
> org/springframework/social/facebook/connect/FacebookConnectionFactory
> at java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:1.8.0_144]
> at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) ~[na:1.8.0_144]
> at java.lang.Class.getDeclaredConstructors(Unknown Source) ~[na:1.8.0_144]
> at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:566)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanFactoryAwareGeneratorStrategy.generate(ConfigurationClassEnhancer.java:252)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:492)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at java.util.concurrent.FutureTask.run(Unknown Source) ~[na:1.8.0_144]
> at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
> ~[spring-core-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> ... 28 common frames omitted Caused by: java.lang.ClassNotFoundException:
> org.springframework.social.facebook.connect.FacebookConnectionFactory
> at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_144]
> at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_144]
> at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
> ~[EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_144]
> ... 42 common frames omitted
>
> 2017-09-27 15:10:03.076 INFO 6740 --- [ main]
> ationConfigEmbeddedWebApplicationContext : Closing
> org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5afa04c:
> startup date [Wed Sep 27 15:10:01 CEST 2017]; parent:
> org.springframework.context.annotation.AnnotationConfigApplicationContext@20fa23c1
> 2017-09-27 15:10:03.076 WARN 6740 --- [ main]
> ationConfigEmbeddedWebApplicationContext : Exception thrown from
> LifecycleProcessor on context close
>
> java.lang.IllegalStateException: LifecycleProcessor not initialized -
> call 'refresh' before invoking lifecycle methods via the context:
> org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5afa04c:
> startup date [Wed Sep 27 15:10:01 CEST 2017]; parent:
> org.springframework.context.annotation.AnnotationConfigApplicationContext@20fa23c1
> at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:427)
> [spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:999)
> [spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
> [spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at at.ennui.backend.EnnuiApplication.main(EnnuiApplication.java:12)
> [classes!/:1.0.0-RELEASE]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
> at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_144]
> at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
>
> 2017-09-27 15:10:03.091 ERROR 6740 --- [ main]
> o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with
> name
> 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory'
> threw an exception
>
> java.lang.IllegalStateException: ApplicationEventMulticaster not
> initialized - call 'refresh' before multicasting events via the
> context:
> org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5afa04c:
> startup date [Wed Sep 27 15:10:01 CEST 2017]; parent:
> org.springframework.context.annotation.AnnotationConfigApplicationContext@20fa23c1
> at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414)
> [spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97)
> ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253)
> ~[spring-beans-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)
> [spring-beans-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)
> [spring-beans-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)
> [spring-beans-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
> [spring-beans-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:230)
> [spring-beans-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)
> [spring-beans-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030)
> [spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1006)
> [spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
> [spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
> at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
> [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
> at at.ennui.backend.EnnuiApplication.main(EnnuiApplication.java:12)
> [classes!/:1.0.0-RELEASE]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
> at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_144]
> at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
> at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
> [EnnuiBackend-1.0.0-RELEASE.jar:1.0.0-RELEASE]
第一个异常可能是因为在我的SocialConfig类中,我使用“Environment”从application.properties中获取一个属性,并且没有任何属性在.jar之外(当它们在jar旁边时也会获取)
但是我不知道其他的例外是什么意思
Application.class:
@SpringBootApplication
public class EnnuiApplication {
public static void main(String[] args) {
SpringApplication.run(EnnuiApplication.class, args);
}
@Bean
public ModelMapper modelMapper(){
return new ModelMapper();
}
}
SocialConfig.class:
@Configuration
public class SocialConfig implements SocialConfigurer {
public void addConnectionFactories(ConnectionFactoryConfigurer cfConfig, Environment env) {
cfConfig.addConnectionFactory(new FacebookConnectionFactory(
env.getProperty("facebook.appId"),
env.getProperty("facebook.appSecret")));
}
@Override
public UserIdSource getUserIdSource() {
return null;
}
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
return null;
}
}
pom.xml:
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>at.ennui</groupId>
<artifactId>EnnuiBackend</artifactId>
<version>1.0.0-RELEASE</version>
<packaging>jar</packaging>
<name>EnnuiBackend</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<repositories>
<repository>
<id>milestone</id>
<name>Spring Miestone Repo</name>
<url>http://repo.spring.io/milestone/</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.SR3</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!--dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-facebook</artifactId>
<version>3.0.0.M3</version>
</dependency-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- spring social facebook dependencies-->
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-facebook</artifactId>
<version>3.0.0.M3</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/spring-social-facebook-3.0.0.M3.jar</systemPath>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.0.pr3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.0.pr3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.0.pr3</version>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-core</artifactId>
<version>2.0.0.M4</version>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-config</artifactId>
<version>2.0.0.M4</version>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-security</artifactId>
<version>2.0.0.M4</version>
</dependency>
<!-- -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>
</project>
4.0.0
厌倦
EnnuiBackend
1.0.0版本
罐子
EnnuiBackend
SpringBoot的演示项目
org.springframework.boot
spring启动程序父级
1.5.6.1发布
里程碑
春天美石回购
http://repo.spring.io/milestone/
UTF-8
UTF-8
1.8
Dalston.SR3
org.springframework.cloud
spring-cloud-starter-oauth2
mysql
mysql连接器java
运行时
org.springframework.boot
弹簧靴启动器jdbc
org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
SpringBootStarterWeb
org.springframework.social
春季社交facebook
3.0.0.M3
系统
${project.basedir}/src/main/resources/spring-social-facebook-3.0.0.M3.jar
com.fasterxml.jackson.core
杰克逊核心
2.9.0.pr3
com.fasterxml.jackson.core
杰克逊数据绑定
2.9.0.pr3
com.fasterxml.jackson.core
杰克逊注释
2.9.0.pr3
org.springframework.social
春季社会核心
2.0.0.M4
org.springframework.social
spring社交配置
2.0.0.M4
org.springframework.social
春季社会保障
2.0.0.M4
org.springframework.boot
弹簧起动试验
测试
com.github.ben-manes.caffine
咖啡因
1.0.0
org.modelmapper
模型映射器
1.1.0
org.springframework.cloud
spring云依赖关系
${spring cloud.version}
聚甲醛
进口
org.springframework.boot
springbootmaven插件
真的
正如JB Nizet所指出的,问题在于没有提供FacebookConnectionFactory
目录jar可以添加到包中。但是,您应该考虑将依赖项安装到本地Maven存储库中,并将其提供给项目,而不是将其传递到目录中。p>
手动将JAR安装到本地Maven存储库中 第一个解决方案是使用Maven目标install:install文件将JAR手动添加到本地Maven存储库中。插件的使用非常简单,如下所示:
mvn安装:安装文件-Dfile=
注意,我们没有指定要安装的JAR的groupId、artifactId、版本和打包。事实上,由于Maven install plugin的2.5版,这些信息可以从可选指定的POM文件中获取
这些信息也可以在命令行中给出:
mvn安装:安装文件-Dfile=-DgroupId=-DartifactId=-Dversion=
其中:
<path-to-file>: Path to the JAR to install
<group-id>: Group id of the JAR to install
<artifact-id>: Artifact id of the JAR to install
<version>: Version of the JAR
这种解决方案可能非常昂贵。为什么?您必须考虑到,在您更改本地Maven存储库的那天,必须重新安装jar。或者,如果有很多人在项目中工作,那么每个人都必须在其本地存储库中安装JAR。必须考虑到项目的可移植性
另一个解决方案是在pom.xml中使用
maven安装插件
,它将在maven“初始化”阶段安装jar。为此,必须指定要安装的jar的位置。最好的方法是将JAR放在项目根目录下创建的文件夹中(与pom.xml文件位于同一目录中)。异常显示:ClassNotFoundException:org.springframework.social.facebook.connect.facebook ConnectionFactory。这个类位于SpringSocialFacebook工件中,但是您已经注释掉了依赖项,将其替换为指向src/main/resources文件夹中的jar文件的系统依赖项。不要这样做。是的,但我必须在社交facebook库中做一些更改,有没有办法“将社交facebook jar合并到我的project.jar中”?为这个修改过的jar选择一个不同的组/工件/版本,并将其安装到你公司的maven存储库中。回答一个老问题时,如果您包含一些上下文来解释您的答案是如何有帮助的,特别是对于已经有公认答案的问题,那么您的答案对其他StackOverflow用户会更有用。请看:。嘿,大卫,这里我只添加了一些示例,它只适用于我的代码。你可以得到一个想法,而不是用户问题的100%正确的解决方案
<dependency>
<groupId>com.roufid.tutorials</groupId>
<artifactId>example-app</artifactId>
<version>1.0</version>
</dependency>