English 中文(简体)
玉米问题
原标题:Question about maven
  • 时间:2010-07-28 12:05:08
  •  标签:
  • maven-2

为什么从存放处下载依赖物,即使jar存在于我的当地存放处(一个原因可能是jar没有om),但是否有办法绕过(只有选择)?

最佳回答

为什么从存放处下载[SNAPSHOT]依赖物,即便在我的当地存放处存在jar。

由于这符合SNASPSHOT附属公司的预期行为。 与固定版本不同的是,Maven将定期尝试下载特定SNAPSHOT的最新版本。 当你依靠正在积极发展的项目时,这非常有用。 Maven Reference:

3.3.1.2. SNAPSHOT Versions

Maven versions can contain a string literal to signify that a project is currently under active development. If a version contains the string “SNAPSHOT,” then Maven will expand this token to a date and time value converted to UTC (Coordinated Universal Time) when you install or release this component. For example, if your project has a version of “1.0-SNAPSHOT” and you deploy this project’s artifacts to a Maven repository, Maven would expand this version to “1.0-20080207-230803-1” if you were to deploy a release at 11:08 PM on February 7th, 2008 UTC. In other words, when you deploy a snapshot, you are not making a release of a software component; you are releasing a snapshot of a component at a specific time.

Why would you use this? SNAPSHOT versions are used for projects under active development. If your project depends on a software component that is under active development, you can depend on a SNAPSHOT release, and Maven will periodically attempt to download the latest snapshot from a repository when you run a build. Similarly, if the next release of your system is going to have a version "1.4", your project would have a version "1.4-SNAPSHOT" until it was formally released.

As a default setting, Maven will not check for SNAPSHOT releases on remote repositories. To depend on SNAPSHOT releases, users must explicitly enable the ability to download snapshots using a repository or pluginRepository element in the POM.

When releasing a project, you should resolve all dependencies on SNAPSHOT versions to dependencies on released versions. If a project depends on a SNAPSHOT, it is not stable as the dependencies may change over time. Artifacts published to non-snapshot Maven repositories such as http://repo1.maven.org/maven2 cannot depend on SNAPSHOT versions, as Maven s Super POM has snapshot s disabled from the Central repository. SNAPSHOT versions are for development only.

如果您真的希望改变这一行为,您可修改贵国的updatePolicy,使您的录音资料库能够:

<repositories>
  <repository>
    <id>my-repo</id>
    <name>My Corporate Repository</name>
    <url>http://repo.mycompany.com/maven2</url>
    <layout>default</layout>
    ...
    <snapshots>
      <enabled>true</enabled>
      <updatePolicy>never</updatePolicy>
      <checksumPolicy>fail</checksumPolicy>
    </snapshots>
  </repository>

转至never,将迫使您使用手册更新(使用mvn-U)。 但这通常不是人们所希望和期望的SNAPSHOT。

纽约总部 允许的指挥线选择 修订

See also

问题回答

可以通过人工安装文档,在贵地方存放处产生一个om子:

mvn install:install-file 
    -Dfile=[FILE]
    -DgroupId=[GROUP]
    -DartifactId=[ARTIFACT]
    -Dversion=[VERSION]
    -Dpackaging=jar 
    -DgeneratePom=true
    -DcreateChecksum=true   

EDIT:你不想照亮。





相关问题
Derby gets stuck closing?

I ve got unit tests (in maven) that use derby. At the end of the test run, there is a very long pause, with these log messages before the pause. INFO: Closing Hibernate SessionFactory Nov 16, 2009 8:...

Execute goal on parent after children complete

I have a multi-module maven project (several levels of nesting). Normally, when I execute a maven build (like mvn install or whatever), maven will run all the goals for the parent project before ...

Including dependencies in a jar with Maven

Is there a way to force maven(2.0.9) to include all the dependencies in a single jar file? I have a project the builds into a single jar file. I want the classes from dependencies to be copied into ...

Java Equivalent of distcc

Distcc makes it easy to distribute a C or C++ compile job across a number of machines, and is a godsend for working with large, frequently-built codebases. An increasing number of our large projects ...

Maven Assembly Problem

I have a maven multiple-module project, which is giving me headaches in the assembly:assembly phase. I have a module which has an assembly defined in it which works fine when I invoke mvn assembly:...

热门标签