[ https://jira.codehaus.org/browse/MCHECKSTYLE-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=347859#comment-347859 ]
Dennis Lundberg commented on MCHECKSTYLE-231: --------------------------------------------- Hi Marcus Looking closer at your stack trace show that the problem occurs when trying to access resources in a JAR file, while looking for a license. This is a new piece of code in this plugin (@since 2.12) Does your project have a LICENSE file in it? Some more questions for you: The configuration in your root pom, is that snippet inside build/pluginManagement/plugins ? You have bound the Checkstyle execution in the root pom to the install phase. So it shouldnät be running if you invoke 'mvn compile' since that does not include the install phase. Is there a special reason why you have bound the plugin execution to the install phase? The other execution in the 'all' profile doesn't have specify a phase, but has the same id as the one in the root pom, so they should be merged when executed. To see your actual running configuration I suggest running the following commands: mvn help:effective-pom > no-profile.txt mvn help:effective-pom -Pall > all-profile.txt The have a look at the generated files to see what differs between them. If you want to have a look at the source, go to this page for instructions: http://maven.apache.org/plugins/maven-checkstyle-plugin/source-repository.html > NPE on mvn compile > ------------------ > > Key: MCHECKSTYLE-231 > URL: https://jira.codehaus.org/browse/MCHECKSTYLE-231 > Project: Maven Checkstyle Plugin > Issue Type: Bug > Affects Versions: 2.12.1 > Environment: Apache Maven 3.2.1 > (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00) > Maven home: /usr/local/Cellar/maven/3.2.1/libexec > Java version: 1.7.0_51, vendor: Oracle Corporation > Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre > Default locale: en_US, platform encoding: UTF-8 > OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac" > checkstyle plugin version: 2.12.1 > Reporter: Marcus Höjvall > Priority: Critical > > I'm getting a NullPointerError when running: > {code} mvn clean compile -Pall {code} > And all is a profile running the checkstyle plugin. This however works if I > run install instead of compile, like this: > {code} mvn clean install -Pall {code} > Compile however works good when running it on a submodule but not on the root > module. > I don't know how to proceed and maven told me to contact the plugin > maintainers through this link: > https://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException > Please let me know if there is anymore information that I need to provide or > other ways to help out > Stacktrace: > {code} > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1:checkstyle (validate) > on project commons: Execution validate of goal > org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1:checkstyle failed. > NullPointerException -> [Help 1] > org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute > goal org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1:checkstyle > (validate) on project commons: Execution validate of goal > org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1:checkstyle failed. > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) > at > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) > at > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) > at > org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) > at > org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) > at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) > at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) > at > org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) > at > org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) > at > org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) > Caused by: org.apache.maven.plugin.PluginExecutionException: Execution > validate of goal > org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1:checkstyle failed. > at > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:144) > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) > ... 19 more > Caused by: java.lang.NullPointerException > at > org.codehaus.plexus.resource.loader.JarHolder.getEntries(JarHolder.java:126) > at > org.codehaus.plexus.resource.loader.JarResourceLoader.loadJar(JarResourceLoader.java:100) > at > org.codehaus.plexus.resource.loader.JarResourceLoader.initialize(JarResourceLoader.java:63) > at > org.codehaus.plexus.resource.loader.JarResourceLoader.getResource(JarResourceLoader.java:141) > at > org.apache.maven.plugin.checkstyle.resource.LicenseResourceManager.getResource(LicenseResourceManager.java:70) > at > org.codehaus.plexus.resource.DefaultResourceManager.getResourceAsFile(DefaultResourceManager.java:91) > at > org.apache.maven.plugin.checkstyle.DefaultCheckstyleExecutor.getOverridingProperties(DefaultCheckstyleExecutor.java:460) > at > org.apache.maven.plugin.checkstyle.DefaultCheckstyleExecutor.getConfiguration(DefaultCheckstyleExecutor.java:299) > at > org.apache.maven.plugin.checkstyle.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:185) > at > org.apache.maven.plugin.checkstyle.AbstractCheckstyleReport.executeReport(AbstractCheckstyleReport.java:488) > at > org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:156) > at > org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:196) > at > org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:104) > at > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) > ... 20 more > {code} > Root pom > {code:xml} > <plugin> > > <artifactId>maven-checkstyle-plugin</artifactId> > <version>2.12.1</version> > <dependencies> > <dependency> > > <groupId>com.izettle</groupId> > > <artifactId>build-tools</artifactId> > <version>1.0</version> > </dependency> > </dependencies> > <executions> > <execution> > <id>validate</id> > <phase>install</phase> > <goals> > > <goal>checkstyle</goal> > </goals> > <configuration> > > <includeTestSourceDirectory>false</includeTestSourceDirectory> > > <failsOnError>true</failsOnError> > > <consoleOutput>true</consoleOutput> > > <configLocation>checkstyle/checkstyle.xml</configLocation> > > <linkXRef>false</linkXRef> > > <propertyExpansion>checkstyle-suppression-file=${project.basedir}/checkstyle-suppression.xml</propertyExpansion> > </configuration> > </execution> > </executions> > </plugin> > {code} > {code:xml} > <profile> > <id>all</id> > <build> > <plugins> > <plugin> > <artifactId>maven-checkstyle-plugin</artifactId> > <executions> > <execution> > <configuration> > > <propertyExpansion>projectDir=${project.basedir </propertyExpansion> > </configuration> > <id>validate</id> > <goals> > <goal>checkstyle</goal> > </goals> > </execution> > </executions> > </plugin> > </plugins> > </build> > </profile> > {code} -- This message was sent by Atlassian JIRA (v6.1.6#6162)