Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Is there anything you would do to make this read simpler? Please post in the Gist comments your thoughts!
Proposed Code:
final File[] shorthand = Maven.resolver().addDependency("G:A:V").addExclusion().groupId("G1").artifactId("A1")
.endExclusion().addExclusion("G2:A2").resolve().withTransitivity().as(File.class);
...is equivalent to:
<dependency>
<groupId>G</groupId>
<artifactId>A</artifactId>
<version>V</version>
<exclusions>
<exclusion>
<groupId>G1</groupId>
<artifactId>A1</artifactId>
</exclusion>
<exclusion>
<groupId>G2</groupId>
<artifactId>A2</artifactId>
</exclusion>
</exclusions>
</dependency>
@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost May 19, 2012

s/addExclusion/excluding/g no need to have endExclusion provided that excluding switches to a subtype

ghost commented May 19, 2012

s/addExclusion/excluding/g no need to have endExclusion provided that excluding switches to a subtype

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost May 19, 2012

withTransitivity might be better placed earlier in the example?

ex. Maven.resolver(withTransitivity())

also how about resolve(File.class)? or resolveAs(File.class)

ghost commented May 19, 2012

withTransitivity might be better placed earlier in the example?

ex. Maven.resolver(withTransitivity())

also how about resolve(File.class)? or resolveAs(File.class)

@ALRubinger

This comment has been minimized.

Show comment Hide comment
@ALRubinger

ALRubinger May 19, 2012

I'm not sure how to avoid the "endExclusion" (or similarly-named construct). In effect here we drill down into a hierarchical level, and need to know somehow that we're going to go back UP from the Exclusion Builder to the Dependency Builder.

Owner

ALRubinger commented May 19, 2012

I'm not sure how to avoid the "endExclusion" (or similarly-named construct). In effect here we drill down into a hierarchical level, and need to know somehow that we're going to go back UP from the Exclusion Builder to the Dependency Builder.

@ALRubinger

This comment has been minimized.

Show comment Hide comment
@ALRubinger

ALRubinger May 19, 2012

WRT your comments on the "withTransitivity" earlier in the example: the current prototype is built in "phases" to follow the grammar:

"I want to (optionally configure from X) and resolve THESE COORDINATES using THIS RESOLUTION STRATEGY, obtaining the result in THIS FORMAT"

...which:

  1. Allows us to address all use cases with the same flow
  2. Minimizes the places that users will have to supply arguments (like "resolver(TransitiveResolutionFilter)") thus keeping fluency

I may very well be overlooking ways to make this simpler, but this is the current POC, based on broader discussion:

https://community.jboss.org/thread/198974#733112

Thanks as always Adrian; love having your eyes around.

Owner

ALRubinger commented May 19, 2012

WRT your comments on the "withTransitivity" earlier in the example: the current prototype is built in "phases" to follow the grammar:

"I want to (optionally configure from X) and resolve THESE COORDINATES using THIS RESOLUTION STRATEGY, obtaining the result in THIS FORMAT"

...which:

  1. Allows us to address all use cases with the same flow
  2. Minimizes the places that users will have to supply arguments (like "resolver(TransitiveResolutionFilter)") thus keeping fluency

I may very well be overlooking ways to make this simpler, but this is the current POC, based on broader discussion:

https://community.jboss.org/thread/198974#733112

Thanks as always Adrian; love having your eyes around.

@Mogztter

This comment has been minimized.

Show comment Hide comment
@Mogztter

Mogztter May 19, 2012

It may not fit with your POC but can save some typing :

Maven.resolver()
    .addDependency("G:A:V").addExclusions("G1:A1", "G2:A2")
    .resolve().withTransitivity().as(File.class);

If I have to use endExclusion() and endDependency() I will exclusively use the maven format "G:A:V" to avoid verbosity (and have no use of groupId() and artifactId()).

It may not fit with your POC but can save some typing :

Maven.resolver()
    .addDependency("G:A:V").addExclusions("G1:A1", "G2:A2")
    .resolve().withTransitivity().as(File.class);

If I have to use endExclusion() and endDependency() I will exclusively use the maven format "G:A:V" to avoid verbosity (and have no use of groupId() and artifactId()).

@ALRubinger

This comment has been minimized.

Show comment Hide comment
@ALRubinger

ALRubinger May 19, 2012

Owner

ALRubinger commented May 19, 2012

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost May 19, 2012

ghost commented May 19, 2012

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost May 19, 2012

ghost commented May 19, 2012

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost May 19, 2012

ghost commented May 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment