Skip to content

Can I select packages with wildcard ? #61

Description

@fperie

Hello,

In the maven plugin assertj-assertions-generator-maven-plugin:2.2.0, I will like to select all classes in the "model" subpackages. Of course, I have multiple "model" subpackages in my project.

I didn't make it work, my actually pom.xml configuration is :

fr.mycompany.**.model

Did I make some mistakes in configuration ?
Or is this functionality with wildcards is unvailable ?

Thanks for your help !

Best Regards,
Fabien

Activity

  1. joel-costigliola commented on Oct 1, 2019

    @joel-costigliola
    Member

    it is java regexp based so try something like fr\.mycompany\.*.*\.model.*

  2. fperie commented on Oct 2, 2019

    @fperie
    Author

    Hello Joel,

    in fact, your feature doesn't work :-(
    In my project, the fr.mycompany subdirectory contains many classes with imports on classes provided by JBoss EAP server.

    Below, the stacktrace throws by the mojo :
    A required class was missing while executing org.assertj:assertj-assertions-generator-maven-plugin:2.2.0:generate-assertions: org/jboss/security/RunAsIdentity

    I think the filtering of full qualified name classes (based on java regexp) is maybe realised after loading classes with Class.forName() for example ?

    For me, there are 2 solutions to solve this problem:

    1. be able to put wilcards on the definition of directory (ex: fr.mycompany.**.model)
    2. add a silent option in the mojo to not crash if a ClassNotFoundException is raised

    I can write and push a pull-request if needed.

    What do you think ?

    Thanks for your help.

    Best Regards,
    Fabien

  3. joel-costigliola commented on Oct 3, 2019

    @joel-costigliola
    Member

    My bad I gave incorrect information, there is no support for regex when specifying packages.
    When a package is specify, it will be introspected along with its subpackages.
    You have then additional configuration to include and exclude classes based on regexes. see http://joel-costigliola.github.io/assertj/assertj-assertions-generator-maven-plugin.html#configuration as a reference.

    If you believe this is not working, please provide a project sample to reprocude the issue.

    Hope it helps!

  4. fperie commented on Oct 8, 2019

    @fperie
    Author

    Hello Joel,

    I created a project sample to reproduce the problem described in issue #61.
    You will find the sources here : https://github.com/fperie/issue_61_assert_assertions_generator_maven_plugin

    The problem occured when a class extends an another class which is in a library injected in provided scope.
    The mojo should not crash.

    What do you think ?

    Best regards,
    Fabien

  5. joel-costigliola commented on Oct 8, 2019

    @joel-costigliola
    Member

    Thanks I will look at it after I release assertj-core 3.14.0, likely in a few weeks.

  6. fperie commented on Oct 8, 2019

    @fperie
    Author

    Hello Joel,

    other question : when I build the mojo with maven in command line, I have 2 failures. Why ?
    How can I have an success build with maven in command line ?
    When I launch the junit tests in Eclipse, all tests are green !

    stdout_maven_clean_install.txt

    Thank's a lot,
    Best regards,
    Fabien

  7. joel-costigliola commented on Oct 8, 2019

    @joel-costigliola
    Member

    👀

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions