-
-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Maven pom.xml to build model #1396
Comments
Just to clarify: you mean to be able to launch Spoon in specifying only a targeted pom.xml and to let Spoon analyze the file and create the model from sources, using the proper dependencies? I like the idea, but I'm not sure if it should be integrated to spoon-core, or if it should be another project which can analyze the pom.xml and then call Spoon with the proper arguments... |
Let me put it in other words: Java Launcher launcher = new Launcher();
launcher.addInputResource("./pom.xml");
launcher.buildModel();
CtModel completeModel = launcher.getModel(); So yes, I would like to add only a pom.xml and create a complete model out of it.
Why would you like to put this feature into another project? Spoon is all about creating models from Java source code, isn't it :). With a little bit of luck, there already is a Maven parser. |
Actually I was thinking about spoon-maven-plugin which is another project, so do we want to include this feature inside spoon-core, or not. Yes, we could do as you propose but maybe it would be better to explicit the fact the pom.xml input resource will impact the classpath and so one. So maybe something like this would be better, WDYT? Launcher launcher = new Launcher();
launcher.setPomProject("./pom.xml");
launcher.buildModel();
CtModel completeModel = launcher.getModel();
See: http://maven.apache.org/components/ref/3.2.5/maven-model/ |
I vote to put it into another project too. Otherwise the spoon core needs a dependency to
|
I assume you don't want those dependencies because of the size of the libraries to add. So as a check I tested to package spoon with and without the new dependency for Maven model resolver, here are the results:
So around 3 Mb more with the new dependency. |
To be honest, that's nothing much compared to JDT (5.6M). Furthermore, the libraries used to download dependencies from Maven repositories can be reused for a potential Gradle parser. |
I tend to agree: i'm not sure it's a real issue to add 3 Mb to the full jar. WDYT @pvojtechovsky @monperrus ? |
I'm in favor of this proposal because:
|
I personally do not need this feature and if you want it in spoon core, then I really have no problem with that ;-) |
Is it possible to create a Spoon model from a single pom.xml? Since the pom contains all dependencies, it should be possible to create a model without noclasspath mode. This feature is not limited to Maven, but could also be added for Ant, Gradle, and even Eclipse project files.
The text was updated successfully, but these errors were encountered: