English 中文(简体)
是否有办法在偶然试图解决这些依赖物之前安装。
原标题:Is there are way to install maven dependencies before maven attempts to resolve them?

我不得不从一个偏远地点卸下一些受扶养人,并在当地安装。

我成功地获得这些产品(使用ant花板),并安装这些产品(使用安装板块)。

然而,如果我将其界定为属地(<dependency></dependency>)。 午餐首先要解决这些障碍,只有这样,如果成功的话,才开始安装和安装。

我也尝试了建筑辅助器和附加材料,但并没有做任何事情(甚至没有在最后战争档案中添加手工艺品)

So, how to run my executions before maven attempts to resolve dependencies?

问题回答

关心问题! 一项尝试(可能的话)将利用一个多模块项目设置。

在母项目中挑选和安装你附属设施,并在儿童单元中使用。 我测试了我这样的假设:

Parent pom.xml

<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>foo.bar</groupId>
    <artifactId>foo.bar.parent</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <modules>
        <module>foo.bar.child</module>
    </modules>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <configuration>
                            <target>
                                <echo
                                    message="Hello world!" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

<>Module pom.xml

<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>foo.bar</groupId>
    <artifactId>foo.bar.child</artifactId>
    <version>1.0.0</version>

    <parent>
        <groupId>foo.bar</groupId>
        <artifactId>foo.bar.parent</artifactId>
        <version>1.0.0</version>
    </parent>

    <dependencies>
        <dependency>
            <artifactId>can.not</artifactId>
            <groupId>find.me</groupId>
            <version>0.0.0</version>
        </dependency>
    </dependencies>

</project>

在儿童单元建设失败(因为缺乏依赖性)之前,我收到母异构体的“Hello World输出”。 如果你能提供母子的抚养,那么就应当建设儿童单元项目。

你们应当看看管阿尔基瓦等手工保存管理人,然后,你可以把他们装到那里,在你的<代码>~/.m2/dings.xml的档案中,添加了你Archiiva服务器,不必担心如何用人工安装当地装置,即假设手工艺品已经放在遥远的存放处。 如果你的“再分配地点”是Maven存放处,Archiiva也可以以透明的方式代理。

I ended up doing it in two phases:

  • setup the antrun and install executions to run on clean
  • when package is chosen, the build would fail if it hasn t been cleaned at least once

The solution introduces a bit of complexity though.

You can try the system scope in dependency and add systemPath:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/myhackedjunit-4.0.jar</systemPath>
</dependency>

The system scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.

The systemPath is used only if the the dependency scope is system. The path must be absolute. Since it is assumed that system scope dependencies are installed a prior, Maven will not check the repositories for the project, but instead checks to ensure that the file exists.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签