Le ven. 26 févr. 2021 à 11:47, Hervé BOUTEMY <herve.bout...@free.fr> a
écrit :

> I don't fully get the logic
>
> but on dependencies injection to the running script, I was just talking
> about:
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-scripting-plugin</artifactId>
>         <version>@project.version@</version>
>         <dependencies>
>           <!-- ScriptEngines -->
>           <dependency>
>             <groupId>org.codehaus.groovy</groupId>
>             <artifactId>groovy-jsr223</artifactId>
>             <version>3.0.7</version> <!-- look for latest -->
>           </dependency>
>           <!-- and any other dependency you'd like to be available -->
>           <dependency>
>             <groupId></groupId>
>             <artifactId></artifactId>
>             <version></version>
>           </dependency>
>         </dependencies>
>       </plugin>
>

Ok, this does not work perfectly since you inherit from a lot using plugin
dependencies so it is always good to be able to isolate a stack, in
particular at compilation time where you will not want to put the plugin
classpath to compile your "script".


>
> regards,
>
> Hervé
>
> Le vendredi 26 février 2021, 09:42:22 CET Romain Manni-Bucau a écrit :
> > here is a draft
> >
> https://github.com/apache/maven-scripting-plugin/tree/rmannibucau/java-scrip
> > ting-draft, still require some more love for dependency management (for
> now
> > it will use project dependencies) but shows the overall idea I guess
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://rmannibucau.metawerx.net/> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau>
> > | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > >
> >
> >
> > Le ven. 26 févr. 2021 à 09:07, Romain Manni-Bucau <rmannibu...@gmail.com>
> a
> >
> > écrit :
> > > Hi Hervé,
> > >
> > > Do you mean project binding and from there use plexus container to
> lookup
> > > anything?
> > > This can work but then the question is what is the value of this
> plugin?
> > > To detail that let me review the usage you can get today:
> > >
> > > 1. groovy -> you will likely use gplus plugin which is more centered on
> > > groovy and way more powerful
> > > 2. js -> likely nashorn-maven-plugin for trivial script which has more
> > > bindings and a better script enclosing but if you really do js you can
> end
> > > up using frontend-maven-plugin which enables a real node scripting
> > > 3. java -> hack with maven compiler+exec-maven-plugin but has the
> > > dependency pitfall
> > > 4. python -> probably acceptable but several jython maven plugins have
> > > more integrations (not using jsr223)
> > > 5. ruby -> jruby-maven-plugin, way more features and configurations
> needed
> > > for ruby (like gems)
> > >
> > > Not sure other languages are often used through JSR223 but overall
> there
> > > is almost no real cases justifying current plugin usage as of today
> > > because
> > > you will quickly hit limitations already solved until your case is very
> > > simple and you just replace ant maven plugin IMHO.
> > >
> > > Indeed, you are fully right, from the project instance you can hack all
> > > you want but then you end up managing complex scripts so it is
> generally
> > > pointless and preferrable to be able:
> > > 1. to configure the engine
> > > 2. configure the bindings from the pom.xml (or have several virtual/or
> not
> > > ones out of the box)
> > > 3. handling the execution environment (which is sometimes linked to 1
> and
> > > sometimes not as for java)
> > >
> > > Java case also needs a bit more like using toolchain and plexus-java
> for
> > > example - until you do it more simply using javac directly but
> wouldn't be
> > > consistent for maven itself.
> > >
> > > Now I fully hear the "there is enough SPI to do it outside" and I can
> > > agree with it but then my question would be "what is the goal of this
> > > plugin" in current ecosystem?
> > > Java integration is an opportunity to give to maven some scripting
> > > capabilities keys in current way to develop for doc and integration
> with
> > > external system but we have alternatives, this is why I sent this mail
> > > before doing all the code - BTW i can push a quick PoC if you want to
> see
> > > more what it can look like, I was not sure it was the way to solve that
> > > extensibility need *from the project* itself.
> > >
> > > Hope it makes sense.
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <https://rmannibucau.metawerx.net/> | Old Blog
> > > <http://rmannibucau.wordpress.com> | Github
> > > <https://github.com/rmannibucau> | LinkedIn
> > > <https://www.linkedin.com/in/rmannibucau> | Book
> > > <
> https://www.packtpub.com/application-development/java-ee-8-high-performan
> > > ce>
> > >
> > >
> > > Le ven. 26 févr. 2021 à 08:40, Hervé BOUTEMY <herve.bout...@free.fr> a
> > >
> > > écrit :
> > >> I don't get every detail, but have one question on dependencies: isn't
> > >> dependency injection to the maven-scripting-plugin sufficient [1]
> > >>
> > >> do you need something more advanced, managed by the
> > >> maven-scripting-plugin
> > >> itself?
> > >>
> > >> Regards,
> > >>
> > >> Hervé
> > >>
> > >> [1]
> > >>
> https://maven.apache.org/plugins-archives/maven-scripting-plugin-LATEST/
> > >> configure-the-script-engine.html
> > >> <
> https://maven.apache.org/plugins-archives/maven-scripting-plugin-LATEST/
> > >> configure-the-script-engine.html>>>
> > >> Le jeudi 25 février 2021, 16:16:09 CET Romain Manni-Bucau a écrit :
> > >> > Le jeu. 25 févr. 2021 à 15:28, Markus KARG <mar...@headcrashing.eu>
> a
> > >> >
> > >> > écrit :
> > >> > > Romain,
> > >> > >
> > >> > > just to understand your target: In the end what you want is that
> the
> > >>
> > >> Java
> > >>
> > >> > > scripting plugin will execute Java source code, just like jshell
> > >> > > does?
> > >> > > That
> > >> > > sounds interesting to me.
> > >> >
> > >> > This is more a side effect, the target is to be able to be able to
> > >>
> > >> replace
> > >>
> > >> > src/main/java/xxxx/build/*.java + exec-maven-plugin setups which has
> > >> > the
> > >> > drawback to require dependencies in the actual module (even in scope
> > >> > provided).
> > >> > The scripting plugin has the opportunity to normalize that through
> the
> > >> > maven-java-scripting-engine which will take this through engine
> > >> > configuration.
> > >> > To illustrate the usage: it generates documentation, typed clients
> > >>
> > >> (http),
> > >>
> > >> > jsonschema, openapi.json, docker images with CDS and much more and
> in a
> > >> > customized fashion.
> > >> > Big gain is to not have to leak all dependencies in the build  and
> keep
> > >> > build part of the build isolated (a profile can enable to code in
> the
> > >>
> > >> IDE
> > >>
> > >> > but when running mvn xxx it is gone/deactivated).
> > >> >
> > >> > Side notes:
> > >> > 1. creating a build module is not an option since it is really about
> > >>
> > >> having
> > >>
> > >> > the build code in the related module and not a "put it all" module
> > >>
> > >> which is
> > >>
> > >> > very hard to maintain.
> > >> > 2. creating a mojo for these needs is inefficient in terms of
> > >>
> > >> maintenance
> > >>
> > >> > and customization level (I come from there) and ultra verbose in the
> > >> > pom
> > >> > compared to this scripting option
> > >> >
> > >> >
> > >> > Hope it clarifies my goal
> > >> >
> > >> > > -Markus
> > >> > >
> > >> > >
> > >> > > -----Ursprüngliche Nachricht-----
> > >> > > Von: Romain Manni-Bucau [mailto:rmannibu...@gmail.com]
> > >> > > Gesendet: Donnerstag, 25. Februar 2021 09:59
> > >> > > An: Maven Developers List
> > >> > > Betreff: Future of maven scripting plugin, java?
> > >> > >
> > >> > > Hi all,
> > >> > >
> > >> > > Wonder if maven scripting plugin has some future plans or not.
> > >> > > Very concretely I'm interested in being able to use java as
> scripting
> > >> > > files
> > >> > > (something along src/build/scripting in terms of structure in
> final
> > >> > > project).
> > >> > > Since we are in maven we have javac so it is not hard to
> implement a
> > >> > > jsr223
> > >> > > (with tool provider or not is a detail) but more complicated
> thing is
> > >>
> > >> the
> > >>
> > >> > > classpath, it needs the plugin to be able to create a classloader
> > >>
> > >> adjusted
> > >>
> > >> > > for that kind of execution (potentially compiling the whole
> scripting
> > >> > > folder). In terms of impacts it means enabling to configure the
> > >> > > script
> > >> > > engine, ie pass args from the mojo to the getScriptEngine method
> > >> > > (typically
> > >> > > kind of the same as exec maven plugin, ie scope/classpath).
> > >> > >
> > >> > > So changes would be:
> > >> > >
> > >> > > 1. implement a java script engine
> > >> > > 2. make the script engine instantiation more configurable
> > >> > >
> > >> > > Do you think it is worth it or exec maven plugin is still
> preferred?
> > >> > >
> > >> > > Romain Manni-Bucau
> > >> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > >> > > <https://rmannibucau.metawerx.net/> | Old Blog
> > >> > > <http://rmannibucau.wordpress.com> | Github <
> > >> > > https://github.com/rmannibucau> |
> > >> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > >> > > <
> > >>
> > >>
> https://www.packtpub.com/application-development/java-ee-8-high-performan
> > >> c
> > >>
> > >> > > e
> > >> > >
> > >> > >
> > >> > >
> > >> > >
> ---------------------------------------------------------------------
> > >> > > 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