View Javadoc
1   package org.apache.maven.plugins.javadoc.stubs;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.File;
23  import java.util.ArrayList;
24  import java.util.Collections;
25  import java.util.List;
26  
27  import org.apache.maven.artifact.repository.ArtifactRepository;
28  import org.apache.maven.artifact.repository.DefaultArtifactRepository;
29  import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
30  import org.apache.maven.model.Build;
31  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
32  
33  /**
34   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
35   */
36  public class TagletArtifactsMavenProjectStub
37      extends MavenProjectStub
38  {
39      /**
40       * Default constructor.
41       */
42      public TagletArtifactsMavenProjectStub()
43      {
44          readModel( new File( getBasedir(), "tagletArtifacts-test-plugin-config.xml" ) );
45  
46          setGroupId( getModel().getGroupId() );
47          setArtifactId( getModel().getArtifactId() );
48          setVersion( getModel().getVersion() );
49          setName( getModel().getName() );
50          setUrl( getModel().getUrl() );
51          setPackaging( getModel().getPackaging() );
52  
53          Build build = new Build();
54          build.setFinalName( getModel().getArtifactId() );
55          build.setSourceDirectory( getBasedir() + "/src/main/java" );
56          build.setDirectory( super.getBasedir() + "/target/test/unit/tagletArtifacts-test/target" );
57          setBuild( build );
58  
59          List<String> compileSourceRoots = new ArrayList<>();
60          compileSourceRoots.add( getBasedir() + "/src/main/java" );
61          setCompileSourceRoots( compileSourceRoots );
62      }
63  
64      /** {@inheritDoc} */
65      @Override
66      public List<ArtifactRepository> getRemoteArtifactRepositories()
67      {
68          ArtifactRepository repository =
69              new DefaultArtifactRepository( "central", "https://repo.maven.apache.org/maven2",
70                                             new DefaultRepositoryLayout() );
71  
72          return Collections.singletonList( repository );
73      }
74  
75      /** {@inheritDoc} */
76      @Override
77      public File getBasedir()
78      {
79          return new File( super.getBasedir() + "/src/test/resources/unit/tagletArtifacts-test" );
80      }
81  }