View Javadoc
1   package org.apache.maven.plugin.surefire.booterclient;
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 org.apache.maven.plugin.surefire.booterclient.lazytestprovider.OutputStreamFlushableCommandline;
23  import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
24  import org.apache.maven.surefire.booter.Classpath;
25  import org.apache.maven.surefire.booter.StartupConfiguration;
26  import org.apache.maven.surefire.booter.SurefireBooterForkException;
27  
28  import javax.annotation.Nonnull;
29  import javax.annotation.Nullable;
30  import java.io.File;
31  import java.util.Map;
32  import java.util.Properties;
33  
34  import static org.apache.maven.shared.utils.StringUtils.join;
35  
36  /**
37   * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
38   * @since 2.21.0.Jigsaw
39   */
40  public final class ClasspathForkConfiguration
41          extends AbstractClasspathForkConfiguration
42  {
43      @SuppressWarnings( "checkstyle:parameternumber" )
44      public ClasspathForkConfiguration( @Nonnull Classpath bootClasspath, @Nonnull File tempDirectory,
45                                         @Nullable String debugLine, @Nonnull File workingDirectory,
46                                         @Nonnull Properties modelProperties, @Nullable String argLine,
47                                         @Nonnull Map<String, String> environmentVariables, boolean debug, int forkCount,
48                                         boolean reuseForks, @Nonnull Platform pluginPlatform,
49                                         @Nonnull ConsoleLogger log )
50      {
51          super( bootClasspath, tempDirectory, debugLine, workingDirectory, modelProperties, argLine,
52                  environmentVariables, debug, forkCount, reuseForks, pluginPlatform, log );
53      }
54  
55      @Override
56      protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
57                                       @Nonnull String booterThatHasMainMethod,
58                                       @Nonnull StartupConfiguration config,
59                                       @Nonnull File dumpLogDirectory )
60              throws SurefireBooterForkException
61      {
62          cli.addEnvironment( "CLASSPATH", join( toCompleteClasspath( config ).iterator(), File.pathSeparator ) );
63          cli.createArg().setValue( booterThatHasMainMethod );
64      }
65  }