为什么Maven不总是从Artefactory下载最后一个依赖项,即从竹子构建?

为什么Maven不总是从Artefactory下载最后一个依赖项,即从竹子构建?,maven,maven-2,msbuild,bamboo,Maven,Maven 2,Msbuild,Bamboo,我使用竹子来自动构建模块,使用maven来构建工具。 它工作正常,但有时需要增加模块的版本(例如从1.0-SNAPSHOT更改为1.1-SNAPSHOT) 我会做以下事情: 1) 在我的svn存储库中的同一目录scructure下标记1.0-SNAPSHOT版本,但标记根目录。这样做是出于兼容性原因。 2) 创建竹子构建计划,用于构建标记的模块。 3) 增加模块的版本,该版本位于主干中 到目前为止还不错。但有时,当我构建客户机的项目时,标记的模块不是从maven下载的(即使我可以看到它是正确地从

我使用竹子来自动构建模块,使用maven来构建工具。 它工作正常,但有时需要增加模块的版本(例如从1.0-SNAPSHOT更改为1.1-SNAPSHOT)

我会做以下事情: 1) 在我的svn存储库中的同一目录scructure下标记1.0-SNAPSHOT版本,但标记根目录。这样做是出于兼容性原因。 2) 创建竹子构建计划,用于构建标记的模块。 3) 增加模块的版本,该版本位于主干中

到目前为止还不错。但有时,当我构建客户机的项目时,标记的模块不是从maven下载的(即使我可以看到它是正确地从竹子构建的),而是在标记之前使用旧的jar。此外,maven并不总是下载最后一个jar,我必须从.m2目录手动删除它,或者更新模块并在我的机器上手动重建它(不使用脱机模式)。这是一件痛苦的事情,但作为一名开发人员,我可以做到这一点,但我们的项目也是由管理员构建的,他们不知道如何管理这一点,他们有时部署具有错误依赖关系的项目,这会导致麻烦:)


因此,如果有人知道如何修复此问题,请告诉我。

查看您的
设置.xml
文件。您会发现这样一个部分:

    <profile>
      <id>FooBar</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>nexus</id>  
          <!-- use a bogus URL as this gets overwritten by the mirror settings -->
          <url>http://central</url>
         <releases>
            <enabled>true</enabled>
             <updatePolicy>daily</updatePolicy>
         </releases>
          <snapshots>
            <enabled>true</enabled>
             <updatePolicy>always</updatePolicy>
         </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>nexus</id>
          <!-- use a bogus URL as this gets overwritten by the mirror settings -->
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>FooBar</activeProfile>
  </activeProfiles>

福巴
关系
http://central
符合事实的
每日的
符合事实的
总是
关系
http://central
符合事实的
每日的
符合事实的
每日的
福巴

确保每次要下载工件的地方都使用
而不是本地工件。

查看
设置.xml
文件。您会发现这样一个部分:

    <profile>
      <id>FooBar</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>nexus</id>  
          <!-- use a bogus URL as this gets overwritten by the mirror settings -->
          <url>http://central</url>
         <releases>
            <enabled>true</enabled>
             <updatePolicy>daily</updatePolicy>
         </releases>
          <snapshots>
            <enabled>true</enabled>
             <updatePolicy>always</updatePolicy>
         </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>nexus</id>
          <!-- use a bogus URL as this gets overwritten by the mirror settings -->
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>FooBar</activeProfile>
  </activeProfiles>

福巴
关系
http://central
符合事实的
每日的
符合事实的
总是
关系
http://central
符合事实的
每日的
符合事实的
每日的
福巴

确保每次要下载工件的地方都使用
始终
,而不是使用本地工件。

在构建依赖于该模块的客户端应用程序时,请尝试
mvn deploy-U
-U
参数用于在构建依赖项目时检索最新构建的快照依赖项(不是引用最新版本,而是引用上次构建的快照工件),在您的情况下,该项目可能是客户端应用程序。

在构建客户端应用程序时,请尝试
mvn deploy-U
,这取决于该模块
-U
参数用于在生成依赖项目时检索最新生成的快照依赖项(不是引用最新版本,而是引用上次生成的快照工件),在您的情况下,该项目可能是客户端应用程序。

这将始终从存储库获取最新快照:mvn-U clean install,这是mvn的缩写——更新快照干净安装您是否可以在本地构建和Bambole服务器中混合使用maven 2和maven 3-不同的版本?这将始终从存储库获取最新快照:mvn-U干净安装,这是mvn的缩写形式--更新快照干净安装您是否可以在本地构建和bamboo服务器中混合使用maven 2和maven 3-不同的版本?我只想在存储库中的代码比本地jar更新时下载。@user358448据我所知,如果本地库更新,maven不会替换它们。“始终”设置只是“始终”尝试更新存储库中的工件(仅当它们较新时)。如果您有很多快照并且需要经常构建,那么这可能非常耗时。因此,如果您确定存储库版本没有更改(但在您的情况下会更改),则可以更改策略。试试看!如果存储库中的代码比我的本地jar更新,我只想下载。@据我所知,如果本地库更新,maven不会替换它们。“始终”设置只是“始终”尝试更新存储库中的工件(仅当它们较新时)。如果您有很多快照并且需要经常构建,那么这可能非常耗时。因此,如果您确定存储库版本没有更改(但在您的情况下会更改),则可以更改策略。试试看!