Skip to content

Docs mention how to run examples but that doesn't work any longer #1702

Closed

Description

@sebkur

I just noticed that in https://github.com/jhy/jsoup/blob/master/src/main/java/org/jsoup/examples/HtmlToPlainText.java#L24
we still say that it'd be possible to run the example like this:

java -cp jsoup.jar org.jsoup.examples.HtmlToPlainText url

while that isn't true anymore and I think I'm responsible due to #700

I'm wondering if we might want do move the example code into a separate module within the repository and add what's necessary to be able to run the examples somehow when one has cloned the sources locally?

I'm not an expert on how to do that with Maven (always using Gradle...) but could dig into it if you're interested in such a contribution.

Otherwise I have set up a standalone version of the examples here: https://github.com/sebkur/jsoup-examples. I guess having some separate repository for examples could also be a sensible approach, what do you think? Maybe it even inspires others to contribute more examples.

Activity

  1. ray-vgw commented on Mar 6, 2022

    @ray-vgw

    Could we do a short-term revert? We are upgrading to newer versions of JSoup and the HtmlToPlainText example is used in our code base and no longer compiles

  2. sebkur commented on Mar 7, 2022

    @sebkur
    ContributorAuthor

    Hmm, I don't think the example code should be used in any code base outside this project. It's not really part of the public API, at least that's how I see it. I think a good solution here is to just copy the source code of that class into your project and potentially improve it and adapt it to your needs.

  3. jhy commented on Dec 16, 2024

    @jhy
    Owner

    Thanks -- fixed with d6ed470. CLI example jar is jsoup-examples.jar.

  4. added
    fixedAn {bug|improvement} that has been {fixed|implemented}
    on Dec 16, 2024
  5. added this to the 1.19.1 milestone on Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixedAn {bug|improvement} that has been {fixed|implemented}

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions