王逍遥这是我们的狗 2017-12-08 02:56 采纳率: 0%
浏览 1764
已采纳

myeclipse+maven ,jar包下载的版本问题

在myeclipse中执行maven install的时候,默认下载maven-jar-plugin-2.4.jar的jar包(不能成功下载),但是本地仓库中已经有了maven-jar-plugin的jar包,但是版本是2.3.1,还有许多其他jar包都有这种版本不对应的情况
我知道这个可以在pom中配置插件版本,但我不能一个个去配置啊
额,之前更换了maven和jdk的版本,我想是不是哪里配置不对了?菜鸟求好心人搭救,感谢!
另外补充一点,maven从3.3.3到3.2.1,我直接copy3.3.3的setting到3.2.1目录下,maven的jar版本是和setting有关吗???

  • 写回答

1条回答 默认 最新

  • JPF1024 2017-12-08 05:32
    关注

    首先setting是可以的,

    另外,版本的问题确实需要一个一个配置,你可以用property的方式去统一配置版本,

    给你个参考:

    统一定义版本:
     <properties>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
         <testversion>1.7</testversion>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
      </properties> 
    

    在引入的地方,使用如下:

     <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>${testversion}</version>
        </dependency>
      </dependencies>
    

    properties块的顺序,记得按照下面这个来:

    <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>
    
      <!-- The Basics -->
      <groupId>...</groupId>
      <artifactId>...</artifactId>
      <version>...</version>
      <packaging>...</packaging>
      <dependencies>...</dependencies>
      <parent>...</parent>
      <dependencyManagement>...</dependencyManagement>
      <modules>...</modules>
      <properties>...</properties>
    
      <!-- Build Settings -->
      <build>...</build>
      <reporting>...</reporting>
    
      <!-- More Project Information -->
      <name>...</name>
      <description>...</description>
      <url>...</url>
      <inceptionYear>...</inceptionYear>
      <licenses>...</licenses>
      <organization>...</organization>
      <developers>...</developers>
      <contributors>...</contributors>
    
      <!-- Environment Settings -->
      <issueManagement>...</issueManagement>
      <ciManagement>...</ciManagement>
      <mailingLists>...</mailingLists>
      <scm>...</scm>
      <prerequisites>...</prerequisites>
      <repositories>...</repositories>
      <pluginRepositories>...</pluginRepositories>
      <distributionManagement>...</distributionManagement>
      <profiles>...</profiles>
    </project> 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题