Here you can find the source of getRoot(final File workingDirectory)
Parameter | Description |
---|---|
workingDirectory | the working-directory. |
public static File getRoot(final File workingDirectory)
//package com.java2s; /*//from w w w . ja v a 2 s .com * #%L * restdoc-plugin * %% * Copyright (C) 2012 IG Group * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import java.io.File; public class Main { /** * The name of POM file. */ public static final String POM_FILE = "pom.xml"; /** * Gets the root (or project) directory of a project. The working-directory * can be any of the modules. * * @param workingDirectory the working-directory. * @return the root-directory. */ public static File getRoot(final File workingDirectory) { File ref = workingDirectory; while (ref.getParentFile() != null && new File(ref.getParentFile(), POM_FILE).exists()) { ref = ref.getParentFile(); } return ref; } }