• Control the scope of your Maven dependencies
    2 Kommentare zu Control the scope of your Maven dependencies

    Dependency management is one of the most powerful Maven features, just add <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>4.3.6.Final</version> </dependency> to your pom.xml and Maven will fetch all the required artifacts (APIs, implementations, required libraries, etc.) for getting started with JPA and Hibernate – no need to care about it. Really?

    Read more
  • Detect immutable objects
    4 Kommentare zu Detect immutable objects

    A recent post demonstrated how singletons can be found in a Java application. There’s another interesting pattern which can be detected using a Cypher query: immutable objects. There are some use cases where they can be very useful, e.g. thread-safe design parameter or return values for non-local interfaces

    Read more
  • Naming rules for Maven modules and packages
    Keine Kommentare zu Naming rules for Maven modules and packages

    The post demonstrates that jQAssistant not only gathers structural information about Java packages or classes but also includes „all the other things around“. Let’s stay with Maven and give another example on how a rule can be created ensuring better „accessibility“ to the code base for developers: The relation between the groupId and artifactId provided…

    Read more
  • Find singletons in a Java application
    Keine Kommentare zu Find singletons in a Java application

    There might be situations where a constraint needs to verify that a certain type is implemented as singleton. In the world of containers (e.g. EJB, CDI) these can be easily identified by the presence of specific annotations: javax.inject.Singleton javax.ejb.Singleton javax.enterprise.context.ApplicationScoped (provides singleton-like semantics) The situation is a bit more difficult if no container is available…

    Read more
  • Hierarchical Maven Structures
    Keine Kommentare zu Hierarchical Maven Structures

    A Java project does not only consist of packages or classes. If the code base grows it normally gets separated into modules managed by the build system. It can be assumed that currently the most popular one in the Java world is Maven. There are lots of people who actually don’t like it too much because it makes strong assumptions on how a project is to be organized and built – this reduced flexibility can be seen as both advantage and disadvantage. But there are still lot of possibilities to create projects structures which are hard to maintain because they are lacking clear rules and structures.

    Read more

Back to Top