src/main/java/org/organicelement/deployment/mojo/DeploymentPackageMojo.java
public final File resolveResource(final String groupId, final String artifactId, final String version,
	      final String classifier) throws MojoExecutionException {
		try {

			if (artifactId == null)
				throw new MojoExecutionException("artifactId of artifact " + groupId + "::" + version + " must be defined");
			if (groupId == null)
				throw new MojoExecutionException("grouId of artifact :" + artifactId + ":" + version + " must be defined");

			String resolvedVersion = version;
			if (version == null) {
				List dependencies = project.getDependencies();
				if (dependencies != null) {
					for (Object depObj : dependencies) {
						if (!(depObj instanceof Dependency))
							continue;

						Dependency dep = (Dependency) depObj;
						if (!groupId.equals(dep.getGroupId()) || !artifactId.equals(dep.getArtifactId()))
							continue;

						resolvedVersion = dep.getVersion();
					}
				}
			}

			Artifact artifact = null;
			if (classifier == null) {
				artifact = getArtifactFactory().createArtifact(groupId, artifactId, resolvedVersion,
				      Artifact.SCOPE_RUNTIME, "jar");
			} else {
				artifact = getArtifactFactory().createArtifactWithClassifier(groupId, artifactId, resolvedVersion, "jar",
				      classifier);
			}

			getArtifactResolver().resolve(artifact, getRemoteRepositories(), getLocalRepository());
			final File artifactFile = artifact.getFile();
			return artifactFile;
		} catch (final Exception e) {
			// Wrap checked exception
			throw new MojoExecutionException("Error while resolving resource " + groupId + ":" + artifactId + ":"
			      + version, e);
		}
	}
/**
	 * This method resolves an artifact on all available repositories and returns the file handle to that artifact.
	 * 
	 * @param groupId the groupId of the artifact to resolve
	 * @param artifactId the artifactId of the artifact to resolve
	 * @param version the version of the artifact to resolve
	 * @param classifier the classifier of the artifact to resolve
	 * @return the resolved file handle of the artifact
	 * @throws MojoExecutionException
	 */
This method resolves an artifact on all available repositories and returns the file handle to that artifact.


This method resolves an artifact on all available repositories and returns the file handle to that artifact .
public final File resolveResource(final String groupId, final String artifactId, final String version,
	      final String classifier) throws MojoExecutionException {
		try {
			if (artifactId == null)
				throw new MojoExecutionException("artifactId of artifact " + groupId + "::" + version + " must be defined");
			if (groupId == null)
				throw new MojoExecutionException("grouId of artifact :" + artifactId + ":" + version + " must be defined");
			String resolvedVersion = version;
			if (version == null) {
				List dependencies = project.getDependencies();
				if (dependencies != null) {
					for (Object depObj : dependencies) {
						if (!(depObj instanceof Dependency))
							continue;
						Dependency dep = (Dependency) depObj;
						if (!groupId.equals(dep.getGroupId()) || !artifactId.equals(dep.getArtifactId()))
							continue;
						resolvedVersion = dep.getVersion();
					}
				}
			}
			Artifact artifact = null;
			if (classifier == null) {
				artifact = getArtifactFactory().createArtifact(groupId, artifactId, resolvedVersion,
				      Artifact.SCOPE_RUNTIME, "jar");
			} else {
				artifact = getArtifactFactory().createArtifactWithClassifier(groupId, artifactId, resolvedVersion, "jar",
				      classifier);
			}
			getArtifactResolver().resolve(artifact, getRemoteRepositories(), getLocalRepository());
			final File artifactFile = artifact.getFile();
			return artifactFile;
		} catch (final Exception e) {
			throw new MojoExecutionException("Error while resolving resource " + groupId + ":" + artifactId + ":"
			      + version, e);
		}
	}
public final File resolveResource ( final String groupId , final String artifactId , final String version , final String classifier ) throws MojoExecutionException { try { if ( artifactId == null ) throw new MojoExecutionException ( "artifactId of artifact " + groupId + "::" + version + " must be defined" ) ; if ( groupId == null ) throw new MojoExecutionException ( "grouId of artifact :" + artifactId + ":" + version + " must be defined" ) ; String resolvedVersion = version ; if ( version == null ) { List dependencies = project . getDependencies ( ) ; if ( dependencies != null ) { for ( Object depObj : dependencies ) { if ( ! ( depObj instanceof Dependency ) ) continue ; Dependency dep = ( Dependency ) depObj ; if ( ! groupId . equals ( dep . getGroupId ( ) ) || ! artifactId . equals ( dep . getArtifactId ( ) ) ) continue ; resolvedVersion = dep . getVersion ( ) ; } } } Artifact artifact = null ; if ( classifier == null ) { artifact = getArtifactFactory ( ) . createArtifact ( groupId , artifactId , resolvedVersion , Artifact . SCOPE_RUNTIME , "jar" ) ; } else { artifact = getArtifactFactory ( ) . createArtifactWithClassifier ( groupId , artifactId , resolvedVersion , "jar" , classifier ) ; } getArtifactResolver ( ) . resolve ( artifact , getRemoteRepositories ( ) , getLocalRepository ( ) ) ; final File artifactFile = artifact . getFile ( ) ; return artifactFile ; } catch ( final Exception e ) { throw new MojoExecutionException ( "Error while resolving resource " + groupId + ":" + artifactId + ":" + version , e ) ; } }
This method resolves an artifact on all available repositories and returns the file handle to that artifact.
This method resolves an artifact on all available repositories and returns the file handle to that artifact .
// Wrap checked exception