You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Steve Hannah <st...@weblite.ca> on 2022/03/04 17:32:18 UTC

Standarded "meta" commands language

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.

Re: Standarded "meta" commands language

Posted by Steve Hannah <st...@weblite.ca>.
I've decided to take a stab at solving this problem by creating a tool that
takes a common, simplified config file as input, and generates the
corresponding configuration for each IDE.  The configuration file
would include a list of actions or tasks that are associated with the
project.  This would roughly map information found in the nbactions.xml
file (for NetBeans) or .idea/workspace.xml file (for IntelliJ).

Creating a configuration tool like this isn't ideal - it would be better if
there were a standard config format that all the IDEs would support - but
it's the best way I can think of that has a chance of working right now.

If anyone knows if such a tool already exists, please let me know.  I'd
rather find out now, than after a month of development :)


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


Yes, I am using this tag already, and it does help.  However I still run
into many cases where this just isn't enough.

<venting>Maven really feels like the "cvs" of build tools, waiting for a
genius like Linux Torvalds to come around and make the "git" of build
tools.</venting>




On Fri, Mar 4, 2022 at 11:45 AM Mantas Gridinas <mg...@gmail.com> wrote:

> 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
>


-- 
Steve Hannah
Web Lite Solutions Corp.

Re: Standarded "meta" commands language

Posted by Mantas Gridinas <mg...@gmail.com>.
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