001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.maven.tools.plugin.extractor.model;
020
021import java.io.File;
022
023/**
024 * Exception when plugin metadata parsing occurred.
025 *
026 * @deprecated Scripting support for mojos is deprecated and is planned tp be removed in maven 4.0
027 */
028@Deprecated
029public class PluginMetadataParseException extends Exception {
030    /** serialVersionUID */
031    static final long serialVersionUID = 4022348153707995574L;
032
033    private final File metadataFile;
034
035    private final String originalMessage;
036
037    /**
038     * @param metadataFile could be null
039     * @param message could be null
040     * @param cause could be null
041     */
042    public PluginMetadataParseException(File metadataFile, String message, Throwable cause) {
043        super("Error parsing file: " + metadataFile + ". Reason: " + message, cause);
044
045        this.metadataFile = metadataFile;
046        this.originalMessage = message;
047    }
048
049    /**
050     * @param metadataFile could be null
051     * @param message could be null
052     */
053    public PluginMetadataParseException(File metadataFile, String message) {
054        super("Error parsing file: " + metadataFile + ". Reason: " + message);
055
056        this.metadataFile = metadataFile;
057        this.originalMessage = message;
058    }
059
060    /**
061     * @return the metadata file
062     */
063    public File getMetadataFile() {
064        return metadataFile;
065    }
066
067    /**
068     * @return the original message
069     */
070    public String getOriginalMessage() {
071        return originalMessage;
072    }
073}