com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.SystemPathArtifactResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch-maven-plugin Show documentation
Show all versions of elasticsearch-maven-plugin Show documentation
A Maven plugin to run a single node Elasticsearch cluster during the integration test phase of a build
/**
* Copyright (C) 2010-2012 Joerg Bellmann
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.alexcojocaru.mojo.elasticsearch.v2.configuration;
import java.io.File;
import org.apache.commons.lang3.Validate;
/**
* Copied from the t7mp project.
* FilesystemArtifactResolver can be used in tests to simulate Maven-Artifact resolution.
*
* @author Joerg Bellmann
*/
public final class SystemPathArtifactResolver
implements PluginArtifactResolver
{
@Override
public File resolveArtifact(String coordinates) throws ArtifactException
{
Validate.notNull(coordinates);
File file = new File(coordinates);
if (file.exists() && file.isFile())
{
return file;
}
throw new ArtifactException(
"Could not find artifact with coordinates: " + coordinates);
}
}