I also sometimes though about it would be useful to have additional data attached to some items in the maven model. In my case it was profile activation, what currently seems limited to hard coded defaults as well...

For example with <configuration> one can just add everything there that is valid XML and then plugins can inspect this.

As XML *can* be extensible, why not simply allow extension elements (e.g. from Maven 4.0 on!) on all the major items like dependency, profiles and so on?

Then extensions to the model can live in an own namespace and one only needs to have a way to access those from the model classes .

For sure this might break older maven versions, but it is often feasible to tell people "this project requires maven <insert your version here> to build"

Am 10.11.22 um 08:45 schrieb Robert Scholte:
Regarding #1 you need to be more precise.
The jigsaw-team also thought it would be easy to extend the pom for this.
However, in the end I discovered there's no need to do this.
The plexus-java library has code which you feed the module descriptor and all jars and it is able to decide if they belong to the modulepath or classpath. Only for testing you might want want to decide where services or static required modules belongs. That's a per-test decision, so can't be done at pom-level. plexus-java[1] has proven itself since Java 9, only edge cases are tricky, but most of the time it is in the details of the specification of the java module system.

Robert

[1] https://codehaus-plexus.github.io/plexus-languages/plexus-java/usage.html


------ Oorspronkelijke bericht ------
Van "Ralph Goers" <ralph.go...@dslextreme.com>
Aan "Maven Developers List" <dev@maven.apache.org>
Datum 10-11-2022 06:08:27
Onderwerp Re: Adding extra "scope" type metadata to dependencies?

Extending the pom.xml has been discussed for years. Unfortunately, it validates the XSD, so when the pom is extended with new attributes older versions of Maven will fail. This is the main reason why import scope was introduced rather than using a new element. There were many discussions about adding provides/requires concepts to the pom as well as other constructs but they always failed due to this.
Ralph

On Nov 8, 2022, at 1:36 PM, Mark Raynsford <org.apache.maven.u...@io7m.com.INVALID> wrote:

Hello!

I'd like to be able to add extra metadata to dependencies in a POM file.
Specifically:

 1. I'd like to be able to specify whether a dependency goes on the
    class or module path rather than have Maven decide for me.

 2. I'd like to be able to specify that a dependency _doesn't_ go on
    either path (possibly because it's going to be added manually
    elsewhere during deployment as an OSGi bundle, or as part of a
    dynamically created module layer, or something similar).

Ideally, the second point would be handled properly by IDEs such that
clicking "Run" wouldn't result in artifacts being added to the
classpath/modulepath of the program the IDE runs.

I remember reading (possibly over a year ago now) that there might be
some possibility of an extension that allows for adding extra
information to a <dependency> element, but I'm now unable to find any
evidence this existed.

Is there some way to do this today? If not... Will there be some way in
Maven 4.0.0+?

-- Mark Raynsford | https://www.io7m.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to