简体   繁体   中英

How to access Maven placeholders from a Maven Plugin?

The original problem

I'm trying to automate my deploying system to my website, but I need to know the actual name of the artifact. I'm using Github Pages, so I don't have backend script possibilities to search for the file extensions, name string contains etc.

My planned solution

I'm about to create a Maven Plugin, and export the final artifact name during the build.

Other encountered problem

To achieve my solution, I have to access the placeholders during the build lifecycle. However, I couldn't find any resource about doing so.

TL;DR;

How can I access Maven build lifecycle placeholders from a Maven Plugin?

You don't have to develop an own plugin to deploy a project to...wherever. You can use the Wagon Maven Plugin :

It allows you to upload resources from your build to a remote location using wagon.

See Maven Wagon for the supported transports.

Within its <configuration> you can use <includes>**/${project.build.finalName}*</includes> (default: ${artifactId}-${version} ) which is an element of the build element . Be aware of:

The term "finalName" is kind of a misnomer, [...]. For example, if the maven-jar-plugin is configured to give a jar a classifier of test , then the actual jar defined above will be built as my-project-1.0-test.jar .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM