-
Notifications
You must be signed in to change notification settings - Fork 82
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
[SHRINKRES-338] Simplify/Improve Readme #204
Conversation
README.md
Outdated
<scope>import</scope> | ||
<type>pom</type> | ||
</dependency> | ||
<!-- Other dependencies --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove
README.md
Outdated
|
||
Maven coordinates follow `groupId:artifactId:[packagingType:[classifier]]:version` format. You can use these coordinates to resolve a file, where `G` is the group ID, `A` is the artifact ID, `P` is the packaging type, `C` is the classifier, and `V` is the version. | ||
|
||
#### Resolve a file using Maven coordinates: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The singular file implicates that only a single file will be resolved, however, all transitive dependencies will be downloaded as well. This should be something like "Resolved file with transitive dependencies using Maven coordinates" or similar
README.md
Outdated
#### Returning Resolved Artifacts | ||
|
||
ShrinkWrap Resolvers provides various options to retrieve resolved artifacts. You can obtain them as files, streams, URLs, or specific archive types like JavaArchive, WebArchive, or EnterpriseArchive. For example: | ||
- Get as a URL: `Maven.resolver().resolve("G:A:V").withTransitivity().as(URL.class)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd replace this with a code block, showing couple of usages, each - perhaps - with a comment explaining the return type ("Get as a URL", "Get as a Java archive", ...)
I'd use URL, JAR, WAR
README.md
Outdated
File file = Maven.resolver().resolve("G:A:V").using(new RejectDependenciesStrategy(false, "G:B")).asFile(); | ||
``` | ||
|
||
#### ShrinkWrap Resolver Strategies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is on the same level as examples above, yet should be nested in the list. Can this be reformatted better?
README.md
Outdated
|
||
#### Available Strategies: | ||
|
||
- **AcceptAllStrategy (Equals TransitiveStrategy):** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equals -> same as
README.md
Outdated
- **RejectDependenciesStrategy:** | ||
Rejects dependencies defined by G:A. By default, it is transitive, meaning all dependencies originating at G:A are removed. To change this behavior to reject defined dependencies but keep their descendants, use `RejectDependenciesStrategy(false, "G:A")`. | ||
|
||
- **TransitiveStrategy (Equals AcceptAllStrategy):** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equals -> Same as
|
||
<sub>**Warning:** ShrinkWrap Resolvers doesn't consume settings.xml specified on the command line or in the IDE. It reads settings.xml files at standard locations: `~/.m2/settings.xml` and `$M2_HOME/conf/settings.xml`, unless overridden in the API or via System property.</sub> | ||
|
||
#### Define Maven repositories manually |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bit about overriding a repository with the same id should probably stay. Perhaps as a note as above?
README.md
Outdated
|
||
In Maven projects, you likely specify dependencies in your pom.xml file. ShrinkWrap Resolvers allows you to avoid redundancy by automatically loading metadata from there. | ||
|
||
- To load dependencies from the POM: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be probably formatted as examples above
README.md
Outdated
|
||
### Resolution of Artifacts from POM Files | ||
|
||
In Maven projects, you likely specify dependencies in your pom.xml file. ShrinkWrap Resolvers allows you to avoid redundancy by automatically loading metadata from there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two sentences seem like they've been extracted from two different paragraphs. I don't really see a connection there. Perhaps instead of redundancy we should focus more on convenience?
Or how do you understand them? @xjusko
README.md
Outdated
|
||
ShrinkWrap Resolvers allows you to override any programmatic configuration via System properties. | ||
|
||
- `org.apache.maven.user-settings` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should probably be explained a little bit. I'm not talking about full table (although it is an option), but providing just the properties and not what they stand for is confusing
README.md
Outdated
|
||
## Embedded Maven | ||
|
||
Embedded Maven allows direct invocation of Maven builds from Java code, offering functionalities such as downloading and using desired Maven binaries, an uncluttered API for simple or complex builds, additional methods for build control (e.g., ignoring failures), and easy access to build outputs and artifacts. It can be invoked using ShrinkWrap Resolver API or custom Invoker and InvocationRequest instances. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would remove the "It can be invoked using ShrinkWrap Resolver API or custom Invoker and InvocationRequest instances." as it brings nothing to the overall readme. It even actually contradicts the old readme as Invoker and InvocationRequests are different from Embedded Maven
README.md
Outdated
|
||
### Downloading Maven Binaries | ||
|
||
Embedded Maven facilitates downloading and using specific Maven versions from Apache web pages, caching downloaded binaries, and setting up Maven home for the build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is just me, but the word "facilitates" screams "I used Chat GPT to write this sentence" for me :)
README.md
Outdated
Embedded Maven facilitates downloading and using specific Maven versions from Apache web pages, caching downloaded binaries, and setting up Maven home for the build. | ||
|
||
```java | ||
EmbeddedMaven.forProject("path/to/pom.xml").useMaven3Version(String version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would either used comments or explained this code block a little bit. For example, I'm missing the information about using cached Maven
README.md
Outdated
Embedded Maven provides features like skipping tests, ignoring failures, logging Maven build invocation commands, and accessing built projects and their artifacts. | ||
|
||
```java | ||
EmbeddedMaven.forProject("path/to/pom.xml").setDebugLoggerLevel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, these could be probably explained a little bit more. The skipTests and ignoreFailure is not shown at all
README.md
Outdated
|
||
```java | ||
EmbeddedMaven.forProject("path/to/pom.xml").setDebugLoggerLevel() | ||
EmbeddedMaven.forProject("path/to/pom.xml").setLogger(yourInvokerLogger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing variable type on the yourInvokerLogger variable. Should be InvokerLogger
README.md
Outdated
EmbeddedMaven.forProject("path/to/pom.xml").setGoals("package").build().getDefaultBuiltArchive(); | ||
``` | ||
|
||
Daemon Build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be formatted as a headline I believe
README.md
Outdated
EmbeddedMaven.forProject("path/to/pom.xml").setGoals("spring-boot:run").useAsDaemon().build(); | ||
``` | ||
|
||
### Experimental Features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add the BuiltProject somewhere, just a line or two about what it is and the "extensive" example from previous Readme
401d624
to
ae3d23d
Compare
@petrberan requested changes should be fixed, can you review it again, please? |
README.md
Outdated
EmbeddedMaven.forProject("path/to/pom.xml").useInstallation(File mavenHome); | ||
// Uses local Maven installation available on your $PATH | ||
EmbeddedMaven.forProject("path/to/pom.xml").useLocalInstallation(); | ||
// Uses the default Maven version, which is currently 3.3.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure about that...
Line 30 in 7405607
String DEFAULT_MAVEN_VERSION = "3.9.6"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to remove the hardcoded version and link the code instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx @xjusko
57ebe09
to
8343327
Compare
CI seems to be stuck, closing and opening the PR again |
https://issues.redhat.com/browse/SHRINKRES-338