Skip to content
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

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

xjusko
Copy link
Contributor

@xjusko xjusko commented May 30, 2024

README.md Outdated
<scope>import</scope>
<type>pom</type>
</dependency>
<!-- Other dependencies -->
Copy link
Member

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:
Copy link
Member

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)`
Copy link
Member

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 Show resolved Hide resolved
README.md Outdated
File file = Maven.resolver().resolve("G:A:V").using(new RejectDependenciesStrategy(false, "G:B")).asFile();
```

#### ShrinkWrap Resolver Strategies
Copy link
Member

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):**
Copy link
Member

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):**
Copy link
Member

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 Show resolved Hide resolved

<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
Copy link
Member

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:
Copy link
Member

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.
Copy link
Member

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`
Copy link
Member

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.
Copy link
Member

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.
Copy link
Member

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)
Copy link
Member

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()
Copy link
Member

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)
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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

README.md Show resolved Hide resolved
@xjusko xjusko force-pushed the improve-readme branch 2 times, most recently from 401d624 to ae3d23d Compare June 19, 2024 06:06
@xjusko
Copy link
Contributor Author

xjusko commented Jun 19, 2024

@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
Copy link
Member

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...

Copy link
Member

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

Copy link
Member

@petrberan petrberan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx @xjusko

@petrberan
Copy link
Member

CI seems to be stuck, closing and opening the PR again

@petrberan petrberan closed this Jun 21, 2024
@petrberan petrberan reopened this Jun 21, 2024
@petrberan petrberan merged commit bee66dd into shrinkwrap:master Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants