Maven SCM
  1. Maven SCM
  2. SCM-350

CVS URL without username or password exception

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Component/s: maven-scm-provider-cvs
    • Labels:
      None
    • Number of attachments :
      1

      Description

      I wanted to use a CVS URL without username or password no matter what in the SCM configuration.
      I was able to do that successfuly for a project without reports using the following:

      pom.xml
      ...
      <scm>
          <connection>
              scm:cvs:pserver:cvs.domain.com.br:/opt/CVS/root:myproject
          </connection>
          <developerConnection>
              scm:cvs:pserver:cvs.domain.com.br:/opt/CVS/root:myproject
          </developerConnection>
      </scm>
      ...
      

      and

      settings.xml
      ...
      <activeProfiles>
          <activeProfile>cvs-username</activeProfile>
      </activeProfiles>
      
      <profiles>
          <profile>
              <id>cvs-username</id>
              <properties>
                  <username>myusername</username>
              </properties>
          </profile>
      </profiles>
      ...
      

      and using CVS login that generates a .cvspass for the user. This way, the pom.xml file is totally free of usernames and passwords. But when generating the site of a project with reports, I got the following error:

      [INFO] Generate "Checkstyle" report.
      [INFO] There are 17 checkstyle errors.
      [INFO] Generate "JavaDocs" report.
      [INFO] Generate "Test JavaDocs" report.
      [INFO] Generate "Source Xref" report.
      [INFO] Generate "Test Source Xref" report.
      [INFO] Generate "CPD Report" report.
      [INFO] Generate "PMD Report" report.
      [INFO] Generate "Continuous Integration" report.
      [INFO] Generate "Dependencies" report.
      [INFO] Generate "Issue Tracking" report.
      [INFO] Generate "Project License" report.
      [INFO] Generate "About" report.
      [INFO] Generate "Project Summary" report.
      [INFO] Generate "Source Repository" report.
      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Username isn't defined.
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      java.lang.IllegalArgumentException: Username isn't defined.
              at org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository.getCvsRootForCvsPass(CvsScmProviderRepository.java:105)
              at org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository.getCvsRoot(CvsScmProviderRepository.java:73)
              at org.apache.maven.report.projectinfo.ScmReport$ScmRenderer.developerAccessCVS(ScmReport.java:479)
              at org.apache.maven.report.projectinfo.ScmReport$ScmRenderer.renderDeveloperAccessSection(ScmReport.java:323)
              at org.apache.maven.report.projectinfo.ScmReport$ScmRenderer.renderBody(ScmReport.java:186)
              at org.apache.maven.reporting.AbstractMavenReportRenderer.render(AbstractMavenReportRenderer.java:65)
              at org.apache.maven.report.projectinfo.ScmReport.executeReport(ScmReport.java:87)
              at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:101)
              at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:67)
              at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:239)
              at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:115)
              at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:124)
              at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:92)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
              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)
      

      Like magic, I found a strange workaround for this. No more errors when using the following SCM configuration:

      pom.xml
      ...
      <scm>
          <connection>
              scm:cvs:pserver:@cvs.domain.com.br:/opt/CVS/root:myproject
          </connection>
          <developerConnection>
              scm:cvs:pserver:@cvs.domain.com.br:/opt/CVS/root:myproject
          </developerConnection>
      </scm>
      ...
      

      YES! A @ difference...
      And yes, it is necessary on both connection and developer connection.

      Well... It works for now, but surely is something to fix.

      1. scm-350.patch
        0.8 kB
        Michael Glauche

        Issue Links

          Activity

          Hide
          Danilo Eiji Seki added a comment -

          By the way, using something like $

          {username}@cvs.domain.com does not work, since the release plugins replaces and commits the ${username}

          with the name of the user who did it.

          Show
          Danilo Eiji Seki added a comment - By the way, using something like $ {username}@cvs.domain.com does not work, since the release plugins replaces and commits the ${username} with the name of the user who did it.
          Hide
          David J. M. Karlsen added a comment -

          Preferably the credentials should be read from settings.xml's server element if not defined in the url.

          Show
          David J. M. Karlsen added a comment - Preferably the credentials should be read from settings.xml's server element if not defined in the url.
          Hide
          Michael Glauche added a comment -

          The getCvsRootForCvsPass is wrong, because it is ok to have a CVSROOT without a username in it, so the exception should not be raised. Furthermore, the getCvsRootWithCorrectUser method does correctly handle null usernames, so the ifNull check is not needed (and is the cause of this bug!)

          scm-350.patch does remove the ifNull check and the Exception, so the correct CVSROOT without any username/password is returned.

          Show
          Michael Glauche added a comment - The getCvsRootForCvsPass is wrong, because it is ok to have a CVSROOT without a username in it, so the exception should not be raised. Furthermore, the getCvsRootWithCorrectUser method does correctly handle null usernames, so the ifNull check is not needed (and is the cause of this bug!) scm-350.patch does remove the ifNull check and the Exception, so the correct CVSROOT without any username/password is returned.

            People

            • Assignee:
              Unassigned
              Reporter:
              Danilo Eiji Seki
            • Votes:
              8 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated: