How do I get Maven to simultaneously deploy artifacts for all supported architectures?

I have a question that is probably very similar to this . I need to decide what I have to imagine in order to be a fairly common problem - how to configure Maven to create several variations of the same artifact, but I still have to find a good solution.

I have a multi-module project, which ultimately leads to the creation of a plugin assemblythat creates an artifact. However, part of the build includes libraries that have changed significantly in the recent past, as a result of which some project users need the N library version, while others need the N + 1 version. Ideally, we simply automatically generate several artifacts, for example. theproject-1.2.3.thelib-1.0.tar.gz, theproject-1.2.3.thelib-1.1.tar.gzetc. (where this release 1.2.3 of our project works against the library version version 1.0 or 1.1).

Right now I have a bunch of default properties that are built against the latest version of the library, as well as a profile created against the old version. I can deploy one or the other in this way, but I cannot deploy them in one assembly. Here's a key wrinkle that differs from the above question: I can't automate build-one-clean-build-the-other inside the plugin release.

As a rule, we are mvn release:prepare release:performfrom the root of a multi-module project to take care of deploying everything in our internal Nexus. However, in this case, we need to choose one - either start the profile of the old library, or start without it, and get a new one. I need a release plugin to deploy both. Is it just not possible? I have to imagine that we are not the first people who want our automated assemblies to generate support for different platforms ...

+3
source share
1 answer

/. attach-artifact build-helper-maven-plugin. - Windows Unix windows/exe unix/sh. .

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>install-installation</id>
            <phase>install</phase>
            <goals>
                <goal>attach-artifact</goal>
            </goals>
            <configuration>
                <artifacts>
                    <artifact>
                        <file>${basedir}/target/${project.artifactId}-${project.version}-windows.exe</file>
                        <classifier>windows</classifier>
                        <type>exe</type>
                    </artifact>
                    <artifact>
                        <file>${basedir}/target/${project.artifactId}-${project.version}-unix.sh</file>
                        <classifier>unix</classifier>
                        <type>sh</type>
                    </artifact>
                </artifacts>
            </configuration>
        </execution>
    </executions>
</plugin>

, .

+3

All Articles