本文整理汇总了Java中org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException类的典型用法代码示例。如果您正苦于以下问题:Java ExpressionEvaluationException类的具体用法?Java ExpressionEvaluationException怎么用?Java ExpressionEvaluationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExpressionEvaluationException类属于org.codehaus.plexus.component.configurator.expression包,在下文中一共展示了ExpressionEvaluationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveProjectLocation
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
@Override
public FileObject resolveProjectLocation(String path) {
if ("".equals(path)) {
return null;
}
try {
String eval = PluginPropertyUtils.createEvaluator(project).evaluate(path).toString();
FileObject toRet = FileUtil.toFileObject(FileUtilities.resolveFilePath(handle.getProject().getBasedir(), eval));
if (toRet != null && toRet.isFolder()) {
toRet = null;
}
return toRet;
} catch (ExpressionEvaluationException ex) {
Exceptions.printStackTrace(ex);
}
return null;
}
示例2: detectUnmanagedModules
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
private void detectUnmanagedModules(EnforcerRuleHelper helper, MavenProject project) throws ExpressionEvaluationException, EnforcerRuleException {
Log log = helper.getLog();
MavenSession session = RuleHelper.getSession(helper);
List<MavenProject> projects = session.getProjects();
ImmutableListMultimap managedDependencies = RuleHelper.getManagedDependenciesAsMap(project);
for (MavenProject mavenProject : projects) {
if (ruleIsDefinedInProjectOrNotModuleParent(mavenProject, log)) {
continue;
}
String projectIdentifier = RuleHelper.getProjectIdentifier(mavenProject);
if (!managedDependencies.containsKey(projectIdentifier)) {
logHeader(log, "manage all modules");
log.warn("unmanaged project found: " + projectIdentifier);
failureDetected = true;
}
}
if (failureDetected) {
throw new EnforcerRuleException("Failing because of unmanaged projects");
}
}
示例3: addProjectDependenciesToClassRealm
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm realm)
throws ComponentConfigurationException {
List<String> runtimeClasspathElements;
try {
// noinspection unchecked
runtimeClasspathElements = (List<String>) expressionEvaluator
.evaluate("${project.runtimeClasspathElements}");
} catch (ExpressionEvaluationException e) {
throw new ComponentConfigurationException(
"There was a problem evaluating: ${project.runtimeClasspathElements}", e);
}
// Add the project dependencies to the ClassRealm
final URL[] urls = buildUrls(runtimeClasspathElements);
for (URL url : urls) {
realm.addURL(url);
}
}
开发者ID:protostuff,项目名称:protostuff-compiler,代码行数:19,代码来源:IncludeProjectDependenciesComponentConfigurator.java
示例4: execute
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException {
Log log = helper.getLog();
List<Pattern> excludedPatterns = new ArrayList<Pattern>(excludes.size());
for (String exclude : excludes) {
excludedPatterns.add(Pattern.compile(exclude));
}
try {
MavenProject project = (MavenProject) helper.evaluate("${project}");
List<Artifact> artifactList = project.getAttachedArtifacts();
for (Artifact artifact : artifactList) {
String artifactFileName = artifact.getFile().getName();
log.debug("evaluating artifact [" + artifactFileName + "]");
for (Pattern pattern : excludedPatterns) {
if (pattern.matcher(artifactFileName).matches()) {
throw new EnforcerRuleException("found banned attached artifact: artifact [" + artifactFileName + "] matched exclude pattern [" + pattern.toString() + "]");
}
}
}
} catch (ExpressionEvaluationException e) {
throw new EnforcerRuleException("Unable to lookup expression", e);
}
}
示例5: addProjectDependenciesToClassRealm
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm)
throws ComponentConfigurationException
{
Set<String> runtimeClasspathElements = new HashSet<String>();
try
{
runtimeClasspathElements.addAll((List<String>) expressionEvaluator
.evaluate("${project.runtimeClasspathElements}"));
}
catch (ExpressionEvaluationException e)
{
throw new ComponentConfigurationException("There was a problem evaluating: ${project.runtimeClasspathElements}",
e);
}
Collection<URL> urls = buildURLs(runtimeClasspathElements);
urls.addAll(buildAritfactDependencies(expressionEvaluator));
for (URL url : urls)
{
// containerRealm.addConstituent(url);
containerRealm.addURL(url);
}
}
示例6: buildAritfactDependencies
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
private Collection<URL> buildAritfactDependencies(ExpressionEvaluator expressionEvaluator)
throws ComponentConfigurationException
{
MavenProject project;
try
{
project = (MavenProject) expressionEvaluator.evaluate("${project}");
}
catch (ExpressionEvaluationException e1)
{
throw new ComponentConfigurationException("There was a problem evaluating: ${project}", e1);
}
Collection<URL> urls = new ArrayList<URL>();
for (Object a : project.getArtifacts())
{
try
{
urls.add(((Artifact) a).getFile().toURI().toURL());
}
catch (MalformedURLException e)
{
throw new ComponentConfigurationException("Unable to resolve artifact dependency: " + a, e);
}
}
return urls;
}
示例7: addProjectDependenciesToClassRealm
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm) throws ComponentConfigurationException {
Set<String> runtimeClasspathElements = new HashSet<String>();
try {
runtimeClasspathElements.addAll((List<String>) expressionEvaluator.evaluate("${project.runtimeClasspathElements}"));
} catch (ExpressionEvaluationException e) {
throw new ComponentConfigurationException("There was a problem evaluating: ${project.runtimeClasspathElements}", e);
}
Collection<URL> urls = this.buildURLs(runtimeClasspathElements);
urls.addAll(this.buildAritfactDependencies(expressionEvaluator));
for (URL url : urls) {
containerRealm.addConstituent(url);
}
}
示例8: buildAritfactDependencies
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
private Collection<URL> buildAritfactDependencies(ExpressionEvaluator expressionEvaluator) throws ComponentConfigurationException {
MavenProject project;
try {
project = (MavenProject) expressionEvaluator.evaluate("${project}");
} catch (ExpressionEvaluationException e1) {
throw new ComponentConfigurationException("There was a problem evaluating: ${project}", e1);
}
Collection<URL> urls = new ArrayList<URL>();
for (Object a : project.getArtifacts()) {
try {
urls.add(((Artifact) a).getFile().toURI().toURL());
} catch (MalformedURLException e) {
throw new ComponentConfigurationException("Unable to resolve artifact dependency: " + a, e);
}
}
return urls;
}
示例9: execute
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException {
Log log = helper.getLog();
try {
// get the various expressions out of the helper.
MavenProject project = (MavenProject) helper.evaluate("${project}");
// MavenSession session = (MavenSession) helper.evaluate("${session}");
// String target = (String) helper.evaluate("${project.build.directory}");
// String artifactId = (String) helper.evaluate("${project.artifactId}");
// ArtifactResolver resolver = (ArtifactResolver) helper.getComponent(ArtifactResolver.class);
// RuntimeInfo rti = (RuntimeInfo) helper.getComponent(RuntimeInfo.class);
List compileSourceRoots = project.getCompileSourceRoots();
for (Object compileSourceRoot : compileSourceRoots) {
String path = (String) compileSourceRoot;
applyForJavaSourcesInRoot(path, log);
}
} catch (ExpressionEvaluationException e) {
throw new EnforcerRuleException("Unable to lookup an expression " + e.getLocalizedMessage(), e);
}
}
示例10: addProjectDependenciesToClassRealm
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm)
throws ComponentConfigurationException
{
List<String> runtimeClasspathElements;
try
{
// noinspection unchecked
runtimeClasspathElements = (List<String>) expressionEvaluator
.evaluate("${project.runtimeClasspathElements}");
}
catch (ExpressionEvaluationException e)
{
throw new ComponentConfigurationException(
"There was a problem evaluating: ${project.runtimeClasspathElements}", e);
}
// Add the project dependencies to the ClassRealm
final URL[] urls = buildURLs(runtimeClasspathElements);
for (URL url : urls)
{
containerRealm.addConstituent(url);
}
}
示例11: evaluate
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
public Object evaluate( String expression, Class<?> type )
throws ExpressionEvaluationException
{
if ( preprocessor != null )
{
try
{
return preprocessor.preprocessValue( expression, type );
}
catch ( BeanConfigurationException e )
{
throw new ExpressionEvaluationException( e.getMessage(), e );
}
}
return expression;
}
示例12: handlePropertyEditorFields
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
private void handlePropertyEditorFields(Object mojo,
List<PropertyEditorField> editorSupportFields,
ExpressionEvaluator expressionEvaluator) {
for (PropertyEditorField propertyEditorField : editorSupportFields) {
PropertyEditorComponent<?> propertyEditorComponent = propertyEditorLookup
.getPropertyEditorComponent(propertyEditorField);
String propertyName = propertyEditorField.getProperty();
Object propValue;
try {
propValue = expressionEvaluator.evaluate("${" + propertyName
+ "}");
if (propValue == null) {
continue;
}
String propertyValueString = null;
propertyValueString = propValue.toString();
propertyEditorField.setValue(propertyEditorComponent,
propertyValueString);
} catch (ExpressionEvaluationException e) {
throw new IllegalStateException("Unable to inject "
+ propertyEditorField + " with property named "
+ propertyName, e);
}
}
}
示例13: addProjectDependenciesToClassRealm
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
private void addProjectDependenciesToClassRealm(ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm)
throws ComponentConfigurationException {
List<String> runtimeClasspathElements;
try {
// noinspection unchecked
runtimeClasspathElements = (List<String>) expressionEvaluator
.evaluate("${project.runtimeClasspathElements}");
} catch (ExpressionEvaluationException e) {
throw new ComponentConfigurationException(
"There was a problem evaluating: ${project.runtimeClasspathElements}", e);
}
// Add the project dependencies to the ClassRealm
final URL[] urls = buildURLs(runtimeClasspathElements);
for (URL url : urls) {
containerRealm.addConstituent(url);
}
}
开发者ID:raphaeljolivet,项目名称:java2typescript,代码行数:19,代码来源:IncludeProjectDependenciesComponentConfigurator.java
示例14: gatherArtifacts
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
@Override
protected void gatherArtifacts() {
try {
List<MavenProject> reactorProjects = (List<MavenProject>)helper.evaluate("${reactorProjects}");
for (MavenProject rp: reactorProjects){
for (Object item : rp.getArtifacts()){
if (item != null && item instanceof Artifact){
Artifact artifact = (Artifact) item;
artifacts.add(artifact);
helper.getLog().debug("[victims-enforcer] adding reactor dependency " + artifact.toString());
}
}
}
} catch (ExpressionEvaluationException ex) {
helper.getLog().debug(ex);
helper.getLog().info("[victims-enforcer] unable to find dependencies using: 'ReactorCollector'");
}
}
示例15: sequenceStart
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; //导入依赖的package包/类
public @Override void sequenceStart(String sequenceId, OutputVisitor visitor) {
session = null;
// Fix for #257563 / SUREFIRE-1158, where surefire 2.19.x
// removed the printing of the output directory. Get the directory from
// the configuration directly or fallback to the plugin standard
if (usingSurefire219(this.config.getMavenProject())) {
// http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#reportsDirectory
String reportsDirectory = PluginPropertyUtils.getPluginProperty(config.getMavenProject(),
Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_SUREFIRE, "reportsDirectory", "test", null); // NOI18N
if (null == reportsDirectory) {
// fallback to default value
try {
Object defaultValue = PluginPropertyUtils.createEvaluator(config.getMavenProject())
.evaluate("${project.build.directory}/surefire-reports");
if (defaultValue instanceof String) {
reportsDirectory = (String) defaultValue;
}
} catch (ExpressionEvaluationException ex) {
// NOP could not resolved default value
}
}
if (null != reportsDirectory) {
File absoluteFile = new File(reportsDirectory);
// configuration might be "target/directory", which is relative
// to the maven project or an absolute path
File relativeFile = new File(this.config.getMavenProject().getBasedir(), reportsDirectory);
if (absoluteFile.exists() && absoluteFile.isDirectory()) {
outputDir = absoluteFile;
} else {
if (relativeFile.exists() && relativeFile.isDirectory()) {
outputDir = relativeFile;
}
}
if (null != outputDir) {
createSession(outputDir);
}
}
}
}