Maven Checkstyle Plugin
  1. Maven Checkstyle Plugin
  2. MCHECKSTYLE-42

checkstyle does not take into account proxy settings from settings.xml

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: None
    • Number of attachments :
      1

      Description

      I've been hesitating wether to report it as bug or as improvement, but at the moment I'd rate it as a bug.
      It took me quite some time to figure out why this was going wrong.
      In my settings.xml I've defined our company proxysettings. These settings are used by Maven when connecting to the remote repository.

      However when using the checkstyle plugin as part of the site generation I can not obtain our checkstyle.xml which is available via http.
      I found a solution by adding the following parameters on the command line when continuum launches maven:
      -Dhttp.proxyHost=myproxy -Dhttp.proxyPort=80

      Wouldn't it be possible for the maven checkstyle plugin to use the settings defined in settings.xml, so I've only to define those once?

      FYI the error generated:

      [INFO] Generate "Dependencies" report.
      [INFO] Generate "Issue Tracking" report.
      [INFO] Generate "Project License" report.
      [INFO] Generate "Mailing Lists" report.
      [INFO] Generate "Source Repository" report.
      [INFO] Generate "Project Team" report.
      [INFO] Generate "Maven Surefire Report" report.
      [INFO] Generate "Checkstyle" report.
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Error during report generation
      
      Embedded error: Unable to find configuration file location.
      http://spirou.mycompany.be/javadev/install/checkstyle/mycompany-checkstyle-1.5.xml
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Error during report generation
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:324)
              at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
              at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
              at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
              at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error during report generation
              at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:389)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
              ... 16 more
      Caused by: org.apache.maven.reporting.MavenReportException: Unable to find configuration file location.
              at org.apache.maven.plugin.checkstyle.CheckstyleReport.getConfigFile(CheckstyleReport.java:879)
              at org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:466)
              at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98)
              at org.apache.maven.plugins.site.SiteMojo.generateReportsPages(SiteMojo.java:802)
              at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:301)
              ... 18 more
      Caused by: java.io.FileNotFoundException: http://spirou.mycompany.be/javadev/install/checkstyle/mycompany-checkstyle-1.5.xml
              at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:789)
              at java.net.URL.openStream(URL.java:913)
              at org.codehaus.plexus.util.FileUtils.copyURLToFile(FileUtils.java:876)
              at org.apache.maven.plugin.checkstyle.Locator.resolveLocation(Locator.java:99)
              at org.apache.maven.plugin.checkstyle.CheckstyleReport.getConfigFile(CheckstyleReport.java:870)
              ... 22 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 48 seconds
      [INFO] Finished at: Thu May 18 17:54:23 CEST 2006
      [INFO] Final Memory: 20M/38M
      [INFO] ------------------------------------------------------------------------
      

        Issue Links

          Activity

          Hide
          Antonio Petrelli added a comment -

          I have the same problem but with a slightly different stack trace, and using version 2.1 of the plugin.
          I am using NTLM APS to connect to the proxy, under Windows XP SP2.

          Here is the log, trying to use checkstyle in Tiles 2:

          + Error stacktraces are turned on.
          [INFO] Scanning for projects...
          [INFO] Searching repository for plugin with prefix: 'checkstyle'.
          [INFO] ----------------------------------------------------------------------------
          [INFO] Building Tiles - Core Library
          [INFO] task-segment: [checkstyle:checkstyle]
          [INFO] ----------------------------------------------------------------------------
          [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
          [INFO] Setting property: velocimacro.messages.on => 'false'.
          [INFO] Setting property: resource.loader => 'classpath'.
          [INFO] Setting property: resource.manager.logwhenfound => 'false'.
          [INFO] **************************************************************
          [INFO] Starting Jakarta Velocity v1.4
          [INFO] RuntimeInstance initializing.
          [INFO] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
          [INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
          [INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
          [INFO] ClasspathResourceLoader : initialization starting.
          [INFO] ClasspathResourceLoader : initialization complete.
          [INFO] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
          [INFO] Default ResourceManager initialization complete.
          [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
          [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
          [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
          [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
          [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
          [INFO] Created: 20 parsers.
          [INFO] Velocimacro : initialization starting.
          [INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
          [ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader.
          [INFO] Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
          [INFO] Velocimacro : VM library template macro registration complete.
          [INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
          [INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
          [INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
          [INFO] Velocimacro : initialization complete.
          [INFO] Velocity successfully started.
          [INFO] [checkstyle:checkstyle]
          [INFO] ------------------------------------------------------------------------
          [ERROR] BUILD ERROR
          [INFO] ------------------------------------------------------------------------
          [INFO] An error has occurred in Checkstyle report generation.

          Embedded error: Unable to find configuration file location.
          svn.apache.org
          [INFO] ------------------------------------------------------------------------
          [INFO] Trace
          org.apache.maven.lifecycle.LifecycleExecutionException: An error has occurred in Checkstyle report generation.
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
          at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
          at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
          at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
          at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
          Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred in Checkstyle report generation.
          at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:79)
          at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
          ... 16 more
          Caused by: org.apache.maven.reporting.MavenReportException: Unable to find configuration file location.
          at org.apache.maven.plugin.checkstyle.CheckstyleReport.getConfigFile(CheckstyleReport.java:919)
          at org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:466)
          at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98)
          at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:73)
          ... 18 more
          Caused by: java.net.UnknownHostException: svn.apache.org
          at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
          at java.net.Socket.connect(Socket.java:519)
          at java.net.Socket.connect(Socket.java:469)
          at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
          at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
          at sun.net.www.http.HttpClient.openServer(HttpClient.java:500)
          at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
          at sun.net.www.http.HttpClient.New(HttpClient.java:306)
          at sun.net.www.http.HttpClient.New(HttpClient.java:318)
          at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:792)
          at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:733)
          at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:658)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:981)
          at java.net.URL.openStream(URL.java:1009)
          at org.codehaus.plexus.util.FileUtils.copyURLToFile(FileUtils.java:876)
          at org.apache.maven.plugin.checkstyle.Locator.resolveLocation(Locator.java:100)
          at org.apache.maven.plugin.checkstyle.CheckstyleReport.getConfigFile(CheckstyleReport.java:910)
          ... 21 more
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 19 seconds
          [INFO] Finished at: Tue Feb 06 09:46:58 CET 2007
          [INFO] Final Memory: 5M/9M
          [INFO] ------------------------------------------------------------------------

          Show
          Antonio Petrelli added a comment - I have the same problem but with a slightly different stack trace, and using version 2.1 of the plugin. I am using NTLM APS to connect to the proxy, under Windows XP SP2. Here is the log, trying to use checkstyle in Tiles 2: + Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'checkstyle'. [INFO] ---------------------------------------------------------------------------- [INFO] Building Tiles - Core Library [INFO] task-segment: [checkstyle:checkstyle] [INFO] ---------------------------------------------------------------------------- [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] ************************************************************** [INFO] Starting Jakarta Velocity v1.4 [INFO] RuntimeInstance initializing. [INFO] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties [INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl) [INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader [INFO] ClasspathResourceLoader : initialization starting. [INFO] ClasspathResourceLoader : initialization complete. [INFO] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl) [INFO] Default ResourceManager initialization complete. [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach [INFO] Created: 20 parsers. [INFO] Velocimacro : initialization starting. [INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm [ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader. [INFO] Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm' [INFO] Velocimacro : VM library template macro registration complete. [INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates [INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions [INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed. [INFO] Velocimacro : initialization complete. [INFO] Velocity successfully started. [INFO] [checkstyle:checkstyle] [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] An error has occurred in Checkstyle report generation. Embedded error: Unable to find configuration file location. svn.apache.org [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException: An error has occurred in Checkstyle report generation. at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115) at org.apache.maven.cli.MavenCli.main(MavenCli.java:256) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred in Checkstyle report generation. at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:79) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534) ... 16 more Caused by: org.apache.maven.reporting.MavenReportException: Unable to find configuration file location. at org.apache.maven.plugin.checkstyle.CheckstyleReport.getConfigFile(CheckstyleReport.java:919) at org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:466) at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98) at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:73) ... 18 more Caused by: java.net.UnknownHostException: svn.apache.org at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.Socket.connect(Socket.java:519) at java.net.Socket.connect(Socket.java:469) at sun.net.NetworkClient.doConnect(NetworkClient.java:157) at sun.net.www.http.HttpClient.openServer(HttpClient.java:388) at sun.net.www.http.HttpClient.openServer(HttpClient.java:500) at sun.net.www.http.HttpClient.<init>(HttpClient.java:233) at sun.net.www.http.HttpClient.New(HttpClient.java:306) at sun.net.www.http.HttpClient.New(HttpClient.java:318) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:792) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:733) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:658) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:981) at java.net.URL.openStream(URL.java:1009) at org.codehaus.plexus.util.FileUtils.copyURLToFile(FileUtils.java:876) at org.apache.maven.plugin.checkstyle.Locator.resolveLocation(Locator.java:100) at org.apache.maven.plugin.checkstyle.CheckstyleReport.getConfigFile(CheckstyleReport.java:910) ... 21 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 19 seconds [INFO] Finished at: Tue Feb 06 09:46:58 CET 2007 [INFO] Final Memory: 5M/9M [INFO] ------------------------------------------------------------------------
          Hide
          Barrie Treloar added a comment -

          My work around is to run with "-cpu -U" as this seems to force the checkstyle plugin to use the proxy specified in settings.xml.

          Show
          Barrie Treloar added a comment - My work around is to run with "-cpu -U" as this seems to force the checkstyle plugin to use the proxy specified in settings.xml.
          Hide
          Stephen Connolly added a comment -

          It makes publishing a org.codehaus.mojo plugin project site from behind a proxy very difficult

          Show
          Stephen Connolly added a comment - It makes publishing a org.codehaus.mojo plugin project site from behind a proxy very difficult
          Hide
          Heinrich Schuchardt added a comment -

          The error persists with Maven 3.0.3 and maven-checkstyle-plugin 2.6. Please, assign the bug.

          Show
          Heinrich Schuchardt added a comment - The error persists with Maven 3.0.3 and maven-checkstyle-plugin 2.6. Please, assign the bug.
          Hide
          Arlo Louis O'Keeffe added a comment -

          I created a simple patch that uses cargo's approach for applying the proxy settings. It's not beautiful but it works.

          Show
          Arlo Louis O'Keeffe added a comment - I created a simple patch that uses cargo's approach for applying the proxy settings. It's not beautiful but it works.

            People

            • Assignee:
              Unassigned
              Reporter:
              Frederic
            • Votes:
              7 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated: