001    package org.apache.maven.project;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *  http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    import java.io.File;
023    
024    /**
025     * Exception that occurs when the project list contains duplicate projects instead of ignoring one.
026     *
027     * @author <a href="mailto:brett@apache.org">Brett Porter</a>
028     */
029    public class DuplicateProjectException
030        extends Exception
031    {
032        private final String projectId;
033    
034        private final File existingProjectFile;
035    
036        private final File conflictingProjectFile;
037    
038        /**
039         * @deprecated use {@link #DuplicateProjectException(String, File, File, String)}
040         */
041        public DuplicateProjectException( String message )
042        {
043            this( null, null, null, message );
044        }
045    
046        /**
047         * @deprecated use {@link #DuplicateProjectException(String, File, File, String)}
048         */
049        public DuplicateProjectException( String message, Exception e )
050        {
051            super( message, e );
052            this.projectId = null;
053            this.existingProjectFile = null;
054            this.conflictingProjectFile = null;
055        }
056    
057        public DuplicateProjectException( String projectId, File existingProjectFile, File conflictingProjectFile,
058                                          String message )
059        {
060            super( message );
061            this.projectId = projectId;
062            this.existingProjectFile = existingProjectFile;
063            this.conflictingProjectFile = conflictingProjectFile;
064        }
065    
066        public String getProjectId()
067        {
068            return projectId;
069        }
070    
071        public File getExistingProjectFile()
072        {
073            return existingProjectFile;
074        }
075    
076        public File getConflictingProjectFile()
077        {
078            return conflictingProjectFile;
079        }
080    }