I remember solving similar issue by binding build goals into the reactor
per profile, as well as changing the scanned modules per profile. ex.
-Posgi would build the project for osgi, -Pjavase would build it for
regular java. In addition, you can run multiple profiles at the same time.
Even right now in one of my projects I override dependencies using profiles
where -Pdev depends on snapshot version and is active by default, -Prelease
is used in CI/CD to pin the snapshot because of how that dependency is
released.

You also mentioned that by default javase and common modules are built. Do
you enable that via profiles activeByDefault tag and modules tag
combination?

If worst comes to worst, you could run multiple POMs. Solution would be
dead simple, albeit require some maintenance.

For reference plugin execution tag
https://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_executions_Tag
Profile tag
https://maven.apache.org/pom.html#Profiles
https://maven.apache.org/guides/introduction/introduction-to-profiles.html#details-on-profile-activation

On Fri, Mar 4, 2022 at 5:32 PM Steve Hannah <st...@weblite.ca> wrote:

> I've developed a few maven plugins and archetypes and one part that I've
> always found difficult is providing "run", "debug", and "build" commands
> for my projects that work well across multiple IDEs and command-line.
>
> Each IDE seems to provide its own method for defining its most commonly
> used tasks.
>
> For example, I have a multi-module project format with submodules "ios",
> "android", "javase", "javascript", and a few more.  These submodules are
> enabled/disabled by adding -Dxxx.platform=ios or -Dxxx.platform=android
> etc..   The default "run" and "debug" commands should enable the "common"
> and "javase" modules, and the actual "exec" stuff is handled inside the
> "javase" module.
>
> There doesn't seem to be a way to bake this just into maven's pom.xml file
> itself.  I always need an extra wrapper around it.
>
> E.g. The regular "run" command, that should be bound to the IDE's run
> project, would be:
> "mvn" "verify" "-Psimulator" "-DskipTests" "-Dxxx.platform=javase" "-e"
>
> Currently I provide a "run.sh" script, and some IntelliJ xml files with run
> configurations, and a Netbeans actions xml file, and a bunch of eclipse
> command files.  I'm now putting together some equivalents for VSCode.  But,
> this is kind of ridiculous.
>
> Maven itself is limited on what you can do with pom.xml properties.  What
> would be ideal is some sort of well-supported Maven run configurations
> standard that is well-supported across IDEs so that we could define a set
> of "tasks" for a project that IDE could then provide to the user as a
> menu.   Each task would include a label, description, and the maven command
> that should be run.
>
> Is there such a standard right now?
>
> How do others deal with this issue?
>
> Thanks for any suggestions
>
> Steve
>
> --
> Steve Hannah
> Web Lite Solutions Corp.
>


-- 
// Mantas

Reply via email to