code: public File resolveMavenArtifact(String artifact) throws ArtifactResolutionException {
      // NOTE: This page on Aether (https://docs.sonatype.org/display/AETHER/Home) states that
      // the plexus container uses the context class loader.
      ClassLoader oldContext = Thread.currentThread().getContextClassLoader();
      try {
        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
      RepositorySystem repoSystem = newRepositorySystem();
      
      RepositorySystemSession session = newSession( repoSystem );
      
      Artifact artifactObj = new DefaultArtifact( artifact );
      
      RemoteRepository repo = new RemoteRepository( "cadmium-central", "default", remoteMavenRepository );
      // TODO: we should remove the snapshot policy in production mode.
      repo.setPolicy(true, new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_ALWAYS, RepositoryPolicy.CHECKSUM_POLICY_WARN));
      repo.setPolicy(false, new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_DAILY, RepositoryPolicy.CHECKSUM_POLICY_WARN));
      
      ArtifactRequest artifactRequest = new ArtifactRequest();
      artifactRequest.setArtifact( artifactObj );
      artifactRequest.addRepository( repo );
      
      ArtifactResult artifactResult = repoSystem.resolveArtifact( session, artifactRequest );
      
      artifactObj = artifactResult.getArtifact();
      
      return artifactObj.getFile();
      }
      finally {
        Thread.currentThread().setContextClassLoader(oldContext);
      }
    }
docs: Fetches a maven artifact and returns a File Object that points to its location.
  
  @param artifact The maven coordinates in the format of <code>groupId:artifactId:type:version</code>
  @return A File Object that points to the artifact.
  @throws ArtifactResolutionException