VitoYi
2017-07-27 03:14
采纳率: 70%
浏览 6.8k
已采纳

IDEA创建的SpringBoot项目,pom.xml在Eclipse上报错

总监非要我把IDEA换成SpringBoot的开发工具 sts(eclipse), 现在将我idea上的项目导入eclipse后,pom.xml报错:

图片说明

图片说明

完整信息如下:
For artifact {org.springframework.boot:spring-boot-starter-data-api:null:jar}: The version cannot be empty. (org.apache.maven.plugins:maven-resources-plugin:2.6:testResources:default-testResources:process-test-resources)

org.apache.maven.artifact.InvalidArtifactRTException: For artifact {org.springframework.boot:spring-boot-starter-data-api:null:jar}: The version cannot be empty.
at org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:148)
at org.apache.maven.artifact.DefaultArtifact.(DefaultArtifact.java:123)
at org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:157)
at org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact(DefaultArtifactFactory.java:57)
at org.apache.maven.project.artifact.MavenMetadataSource.createDependencyArtifact(MavenMetadataSource.java:328)
at org.apache.maven.project.artifact.MavenMetadataSource.createArtifacts(MavenMetadataSource.java:503)
at org.apache.maven.lifecycle.internal.DefaultProjectArtifactFactory.createArtifacts(DefaultProjectArtifactFactory.java:50)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:119)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:245)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:330)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360)
at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52)
at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

pom.xml中还有这个也报错:

图片说明

图片说明

求教是什么原因,如何解决?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

8条回答 默认 最新

  • wlq199101 2017-07-27 09:39
    已采纳
     <dependencies>
                        <dependency>
                            <groupId>com.alibaba</groupId>
                            <artifactId>druid</artifactId>
                            <version>1.0.11</version>
                        </dependency>
    
                        <dependency>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>${mysql.version}</version>
                        </dependency>
    
     #数据源配置信息
    datasource.initialSize=5
    datasource.minIdle=5
    datasource.maxActive=20
    datasource.testOnBorrow=true
    datasource.filters=stat,wall
    #数据源名称(与下列配置的数据源对应,多个数据源要配多个名称)
    jdbc.datasources=ds,ds1
    #主数据源,默认的
    jdbc.ds.dsType=com.alibaba.druid.pool.DruidDataSource
    jdbc.ds.driverClassName=com.mysql.jdbc.Driver
    jdbc.ds.url=jdbc:mysql://localhost:3306/spring_boot
    jdbc.ds.username=root
    jdbc.ds.password=root
    
    #从数据源1
    jdbc.ds1.dsType=com.alibaba.druid.pool.DruidDataSource
    jdbc.ds1.driverClassName=com.mysql.jdbc.Driver
    jdbc.ds1.url=jdbc:mysql://localhost:3306/spring_boot1
    jdbc.ds1.username=root
    jdbc.ds1.password=root
    
    

    总之没用到 spring-boot-starter-data-api

    打赏 评论
  • 冯佳兴 2017-07-27 03:24

    我想说博主你经历了什么?

    打赏 评论
  • Jerry_loon 2017-07-27 03:47

    你update一下Maven工程, 或许是你的本地仓库里面没有 看看他会不会下这个版本

    打赏 评论
  • VitoYi 2017-07-27 04:01

    感谢回复,我已经尝试把本地仓库删除然后重新下载,eclipse上依然报错,idea依然没问题

    打赏 评论
  • wlq199101 2017-07-27 04:05

    表示没找到 spring-boot-starter-data-api 只有 spring-boot-starter-data-jpa
    可以自己去库里查 :https://mvnrepository.com/search?q=spring-boot-starter

    图片说明

    打赏 评论
  • 杜汝明 2017-07-27 05:28

    这个问题就是由于maven整合时 下载的jar包版本不对导致的

    打赏 评论
  • VitoYi 2017-07-27 06:40

    问题解决了,原来不是要加东西,也不是缺少了什么jar,而是要减东西。把spring-boot-starter-data-api组件注释掉就完美解决了,我也很纳闷,要操作数据库,不是应该需要用到这个组件吗?怎么在idea里面没问题,eclipse里面一直报错,注释掉反而正常了

    图片说明

    打赏 评论
  • luofangfu 2017-08-01 03:47

    应该是缺少版本号:

    打赏 评论

相关推荐 更多相似问题