本文整理汇总了Java中org.apache.maven.model.Build.getSourceDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java Build.getSourceDirectory方法的具体用法?Java Build.getSourceDirectory怎么用?Java Build.getSourceDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Build
的用法示例。
在下文中一共展示了Build.getSourceDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertModel
import org.apache.maven.model.Build; //导入方法依赖的package包/类
public static MavenModel convertModel(Model model, File projectDir) {
Build build = model.getBuild();
List<String> sources = new ArrayList<>();
List<String> testSources = new ArrayList<>();
if (build != null) {
String sourceDirectory = build.getSourceDirectory();
if (sourceDirectory != null) {
sources.add(sourceDirectory);
}
String testSourceDirectory = build.getTestSourceDirectory();
if (testSourceDirectory != null) {
testSources.add(testSourceDirectory);
}
}
return convertModel(
model,
projectDir,
sources,
testSources,
Collections.emptyList(),
Collections.emptyList(),
null);
}
示例2: mergeBuild_SourceDirectory
import org.apache.maven.model.Build; //导入方法依赖的package包/类
protected void mergeBuild_SourceDirectory( Build target, Build source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getSourceDirectory();
if ( src != null )
{
if ( sourceDominant || target.getSourceDirectory() == null )
{
target.setSourceDirectory( src );
target.setLocation( "sourceDirectory", source.getLocation( "sourceDirectory" ) );
}
}
}
示例3: findFunktionLocation
import org.apache.maven.model.Build; //导入方法依赖的package包/类
protected String findFunktionLocation(Project project, File baseDir, String action) {
// lets try find maven stuff
MavenFacet maven = project.getFacet(MavenFacet.class);
List<String> directories = new ArrayList<>();
if (maven != null) {
Model pom = maven.getModel();
if (pom != null) {
Build build = pom.getBuild();
if (build != null) {
String sourceDirectory = build.getSourceDirectory();
if (sourceDirectory != null) {
directories.add(sourceDirectory);
}
}
}
}
directories.addAll(Arrays.asList("src/main/groovy", "src/main/kotlin", "src/main/java", "src/main/scala"));
int idx = action.indexOf("::");
String className = action;
String methodName = null;
if (idx > 0) {
className = action.substring(0, idx);
methodName = action.substring(idx + 2);
}
List<String> extensions = Arrays.asList(".groovy", ".kotlin", ".kt", ".java", "Kt.kt");
className = className.replace('.', '/');
for (String directory : directories) {
File dir = new File(baseDir, directory);
if (dir.isDirectory()) {
// lets look for the files that match
for (String extension : extensions) {
String fileName = directory + "/" + className + extension;
File file = new File(baseDir, fileName);
if (file.isFile()) {
return fileName;
}
}
}
}
return null;
}
示例4: assembleBuildInheritance
import org.apache.maven.model.Build; //导入方法依赖的package包/类
@SuppressWarnings( "unchecked" )
public void assembleBuildInheritance( Build childBuild, Build parentBuild, boolean handleAsInheritance )
{
// The build has been set but we want to step in here and fill in
// values that have not been set by the child.
if ( childBuild.getSourceDirectory() == null )
{
childBuild.setSourceDirectory( parentBuild.getSourceDirectory() );
}
if ( childBuild.getScriptSourceDirectory() == null )
{
childBuild.setScriptSourceDirectory( parentBuild.getScriptSourceDirectory() );
}
if ( childBuild.getTestSourceDirectory() == null )
{
childBuild.setTestSourceDirectory( parentBuild.getTestSourceDirectory() );
}
if ( childBuild.getOutputDirectory() == null )
{
childBuild.setOutputDirectory( parentBuild.getOutputDirectory() );
}
if ( childBuild.getTestOutputDirectory() == null )
{
childBuild.setTestOutputDirectory( parentBuild.getTestOutputDirectory() );
}
// Extensions are accumulated
mergeExtensionLists( childBuild, parentBuild );
if ( childBuild.getDirectory() == null )
{
childBuild.setDirectory( parentBuild.getDirectory() );
}
if ( childBuild.getDefaultGoal() == null )
{
childBuild.setDefaultGoal( parentBuild.getDefaultGoal() );
}
if ( childBuild.getFinalName() == null )
{
childBuild.setFinalName( parentBuild.getFinalName() );
}
ModelUtils.mergeFilterLists( childBuild.getFilters(), parentBuild.getFilters() );
List<Resource> resources = childBuild.getResources();
if ( ( resources == null ) || resources.isEmpty() )
{
childBuild.setResources( parentBuild.getResources() );
}
resources = childBuild.getTestResources();
if ( ( resources == null ) || resources.isEmpty() )
{
childBuild.setTestResources( parentBuild.getTestResources() );
}
// Plugins are aggregated if Plugin.inherit != false
ModelUtils.mergePluginLists( childBuild, parentBuild, handleAsInheritance );
// Plugin management :: aggregate
PluginManagement dominantPM = childBuild.getPluginManagement();
PluginManagement recessivePM = parentBuild.getPluginManagement();
if ( ( dominantPM == null ) && ( recessivePM != null ) )
{
// FIXME: Filter out the inherited == false stuff!
childBuild.setPluginManagement( recessivePM );
}
else
{
ModelUtils.mergePluginLists( childBuild.getPluginManagement(), parentBuild.getPluginManagement(), false );
}
}