Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
217 views
in Technique[技术] by (71.8m points)

java - Multiple install:install-file in a single pom.xml

(Please read at least this before answering: This is a temporary measure! No, we do not want to set up a local repository manager and manually run a script)

We have a legacy project with a few dependencies which we have a local copy of including source and javadoc, and which has been proven to work well in production, but which is not available in the same quality in Central. We want to use those jars we already have.

I have found that I can manually run a suitably complex mvn install:install-file command to get the artifacts injected in the repository of the local machine, but I would like to have it work as part of the normal maven build of our various modules.

Given I have an otherwise blank module containing multiple jars which each need to be inserted with an install:install-file how should I do this in my pom.xml to be fully conformant with the normal Maven build?

Or can I just attach multiple jars to be the output of the module and somehow attach javadoc and source too)?

(and, please, no suggestion about submitting to central or setting up a local repository manager. This is a temporary solution until we have an opportunity to upgrade to a newer version of the dependencies)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I would imagine something like this would work (this will install it on every build):

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <executions>
                <execution>
                    <id>inst_1</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <!-- config for file 1 -->
                    </configuration>
                </execution>
                <execution>
                    <id>inst_2</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <!-- config for file 2 -->
                    </configuration>
                </execution>
                <!-- execution file 3... -->
            </executions>
        </plugin>            
    </plugins>
</build>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...