Maven
  1. Maven
  2. MNG-4718

[regression] Missing Class in 3.0-beta-1: org.apache.maven.project.artifact.AttachedArtifact

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0-beta-1
    • Fix Version/s: 3.0-beta-2
    • Labels:
      None
    • Environment:
    • Complexity:
      Intermediate
    • Number of attachments :
      1

      Description

      I have a custom plugin that I wrote to support WebSphere Message Broker BAR files.
      It works fine under 2.0.9, 2.0.11 and 2.2.1. I tried it under 3.0-beta-1 and got:

              at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:129)
              ... 20 more
      Caused by: java.lang.NoClassDefFoundError: org.apache.maven.project.artifact.AttachedArtifact
              at com.ibm.issw.maven.plugins.messagebroker.AbstractMessageBrokerMojo.addAttachedArtifact(AbstractMessageBrokerMojo.java:48)
              at com.ibm.issw.maven.plugins.messagebroker.GenerateDeploymentPackages.generateDeploymentPackages(GenerateDeploymentPackages.java:204)
              at com.ibm.issw.maven.plugins.messagebroker.GenerateDeploymentPackages.execute(GenerateDeploymentPackages.java:62)
              at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
              ... 20 more

      The code that is calling it is:

          /**
           * Add an additional file artefact to the Maven project.
           * @param artefactFile The file to add.
           * @param classifier A classifier.
           * @param extension The file type extension.
           */
          protected void addAttachedArtifact(String artefactFile, String classifier, final String extension)
          {
              Artifact artifact = new AttachedArtifact(project.getArtifact(), project.getPackaging(), classifier, new DefaultArtifactHandler()
              {
                  public String getExtension()
                  {
                      return extension;
                  }
              });
              artifact.setFile(new File(artefactFile));
              artifact.setResolved(true);
              project.addAttachedArtifact(artifact);
          }

      It's failing on the first line of the method (new AttachedArtifact()...).

      1. build.log
        285 kB
        Chris Graham

        Activity

        Hide
        Benjamin Bentmann added a comment -

        Fixed in r960855.

        FYI, AttachedArtifact is an internal implementation class, you should be using MavenProjectHelper.attachArtifact() instead.

        Show
        Benjamin Bentmann added a comment - Fixed in r960855 . FYI, AttachedArtifact is an internal implementation class, you should be using MavenProjectHelper.attachArtifact() instead.
        Hide
        Chris Graham added a comment -

        Thank you for the outstandingly fast resolution!
        I've also fixed my code.
        Thanks!
        -Chris

        Show
        Chris Graham added a comment - Thank you for the outstandingly fast resolution! I've also fixed my code. Thanks! -Chris

          People

          • Assignee:
            Benjamin Bentmann
            Reporter:
            Chris Graham
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: