使用 Maven 下载依赖项,而不需要对我的项目进行 Maven 修改

发布于 2024-12-09 09:47:49 字数 438 浏览 4 评论 0原文

我正在考虑使用 Spring Batch,这似乎主要是 使用 Maven 进行分布式/管理。我不是 Maven 用户(我总是不使用 Ant),并且不觉得我应该纯粹为了能够使用 Spring Batch 而需要对我的项目进行 mavenise。

是否有任何工具或 Maven 命令可用于下载各种依赖项? Spring Batch 的最新版本没有标记为“具有依赖项”。

我应该创建一个使用 Spring Batch 的 Maven 项目,然后下载类似的依赖项,然后提取我需要的 jar 吗?

I am looking at using Spring Batch, which seems to mainly be distributed/managed using Maven. I am not a Maven user (I've always got away with using Ant), and don't feel I should need to mavenise my project purely in order to be able to use Spring Batch.

Are there any tools or Maven commands that I can use to download the various dependencies? There are no recent releases of Spring Batch that are marked "with dependencies".

Should I just create a Maven project that uses Spring Batch and then download the dependencies like that and then extract the jars that I need?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情绪少女 2024-12-16 09:47:49

使用maven ant工具或ivy将构建的ant连接到maven依赖/存储库系统。

Use the maven ant tools or ivy to connect an ant built to the maven dependency/repository system.

归属感 2024-12-16 09:47:49

这是我用的。如果将其放入 pom.xml 中,则可以

mvn dependency:copy-dependencies

从命令行运行,最终会在 libs 目录中得到 jar。

<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>GuavaExtensions</groupId>
  <artifactId>guavaExtensions</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
    <dependency>
      <groupId>com.chuusai</groupId>
      <artifactId>shapeless_2.10.0-M3</artifactId>
      <version>1.2.2</version>
      <exclusions>
        <exclusion>
          <artifactId>scala-library</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
        <exclusion>
          <artifactId>scala-actors</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
        <exclusion>
          <artifactId>scala-reflect</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>12.0</version>
    </dependency>
    <dependency>
      <artifactId>asm</artifactId>
      <groupId>org.ow2.asm</groupId>
      <version>4.0</version>
      <classifier>sources</classifier>
    </dependency>
    <dependency>
      <artifactId>asm</artifactId>
      <groupId>org.ow2.asm</groupId>
      <version>4.0</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.10</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_2.10.0-M4</artifactId>
      <version>1.9-2.10.0-M4-B2</version>
      <exclusions>
        <exclusion>
          <artifactId>scala-library</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
        <exclusion>
          <artifactId>scala-actors</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
        <exclusion>
          <artifactId>scala-reflect</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
            <execution>
              <id>default-cli</id>
              <phase>install</phase>
              <goals>
                <goal>copy-dependencies</goal>
              </goals>
              <configuration>
                <outputDirectory>./libs</outputDirectory>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>

Here's what I use. If you put this is in pom.xml, you can run

mvn dependency:copy-dependencies

from a command line and you'll end up with jars in your libs directory.

<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>GuavaExtensions</groupId>
  <artifactId>guavaExtensions</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
    <dependency>
      <groupId>com.chuusai</groupId>
      <artifactId>shapeless_2.10.0-M3</artifactId>
      <version>1.2.2</version>
      <exclusions>
        <exclusion>
          <artifactId>scala-library</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
        <exclusion>
          <artifactId>scala-actors</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
        <exclusion>
          <artifactId>scala-reflect</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>12.0</version>
    </dependency>
    <dependency>
      <artifactId>asm</artifactId>
      <groupId>org.ow2.asm</groupId>
      <version>4.0</version>
      <classifier>sources</classifier>
    </dependency>
    <dependency>
      <artifactId>asm</artifactId>
      <groupId>org.ow2.asm</groupId>
      <version>4.0</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.10</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_2.10.0-M4</artifactId>
      <version>1.9-2.10.0-M4-B2</version>
      <exclusions>
        <exclusion>
          <artifactId>scala-library</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
        <exclusion>
          <artifactId>scala-actors</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
        <exclusion>
          <artifactId>scala-reflect</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
            <execution>
              <id>default-cli</id>
              <phase>install</phase>
              <goals>
                <goal>copy-dependencies</goal>
              </goals>
              <configuration>
                <outputDirectory>./libs</outputDirectory>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文