Category Archives: Maven

In my opinion, Netbeans is one of the most intuitive Java IDE today, especially when it comes to maven development. There was just one missing feature I was always upset about. The IDE was not indexing classes and their dependencies in the local maven repository. So it was not possible to find referenced classes contained in maven projects that weren’t opened in the IDE. This is quiet annoying if you need to gain an overview of the code, or you have to track down one specific misbehavior especially if you work with hundreds of maven projects.

So, together with Netbeans contributors (mainly Jesse Glick), we’ve worked out a solution for the problem.

The class dependencies were found by bytecode parsing and then indexed with Lucene for very fast search results. All classes from the JDK are excluded to reduce the overhead.

Find Usages in action

In the following example, I selected the class “org.apache.maven.artifact.ArtifactUtils” and searched with “Find Usages” for all referring classes. The class is used as an import in one of the classes in the only loaded maven project “Maven Release Plugin”.

This gave me the following output:

Under the node “Maven Repository: local” are all hits listed found in the local maven repository. This enables the developer to quickly scan all interesting artifacts without the need to open any maven project in Netbeans.

For now, only the class name is highlighted and linked to the corresponding class located in the maven artifact. I plan to implemented the same behavior as seen as in the search results for already opened projects, in this case “Maven Release Plugin” which features enhanced line highlighting and more precisely jumps to the source code.

Conclusion

It took my some time to get used to a small part of the massive code base of Netbeans and it’s API’s but it felt good to give something back to the community.

Last but not least, I was able to improve my knowledge in programming across the board which was a lot of fun! 😎

Recently Eclipse 3.7 Indigo with M2E Plugin 1.0.0 was released. Since Eclipse 3.7, M2E is part of the Eclipse Foundation. I had expected better of it.

Since M2E 1.0.0, the plugin features a new life-cycle connector concept for maven-plugins. M2E users are now forced to provide a connector for every plugin used in their builds or if none connectors are available, to ignore the connectors. Unfortunately, to ignore the missing connectors the user is required to modify his pom files for M2E to work properly.

If a maven-plugin is missing a connector, M2E will show you errors like: Plugin execution not covered by lifecycle configruation: {plugin-GAV-goals} and prompts you to modify your project pom or parent pom as following:

XHTML

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

<pluginManagement>

<plugins>

<!--This plugin's configuration is used to store Eclipse m2e settings

only. It has no influence on the Maven build itself. -->

<plugin>

<groupId>org.eclipse.m2e</groupId>

<artifactId>lifecycle-mapping</artifactId>

<version>1.0.0</version>

<configuration>

<lifecycleMappingMetadata>

<pluginExecutions>

<pluginExecution>

<pluginExecutionFilter>

<groupId>

// plugin groupId

</groupId>

<artifactId>

// plugin artifactId

</artifactId>

<versionRange>

[1.0,) // plugin versions

</versionRange>

<goals>

// plugin goals

<goal>create</goal>

</goals>

</pluginExecutionFilter>

<action>

// M2E should ignore the plugin

<ignore></ignore>

</action>

</pluginExecution>

</pluginExecutions>

</lifecycleMappingMetadata>

</configuration>

</plugin>

</plugins>

</pluginManagement>

This means that M2E is no longer an interpreter of Maven, it’s a modifier. It binds your independent Maven projects to a specific IDE, which is in my opinion the wrong path. I’d prefer a much more “lighter” Maven integration in Eclipse, for example like NetBeans 7.x does. This led to several discussions on the M2E mailing-list. As a result, I created an enhancement-request with collected and own suggestions from the list.

I hope an enhancement will soon be released, I could imagine that this will be a real deal breaker for several users to use M2E-1.0.0+.