Java Code Examples for org.apache.maven.model.Build#setSourceDirectory()
The following examples show how to use
org.apache.maven.model.Build#setSourceDirectory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeScriptDTOGeneratorMojoProjectStub.java From che with Eclipse Public License 2.0 | 5 votes |
/** Default constructor */ public TypeScriptDTOGeneratorMojoProjectStub() { MavenXpp3Reader pomReader = new MavenXpp3Reader(); Model model; try { model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml"))); setModel(model); } catch (Exception e) { throw new RuntimeException(e); } setGroupId(model.getGroupId()); setArtifactId(model.getArtifactId()); setVersion(model.getVersion()); setName(model.getName()); setUrl(model.getUrl()); setPackaging(model.getPackaging()); Build build = new Build(); build.setFinalName(model.getArtifactId()); build.setDirectory(getBasedir() + "/target"); build.setSourceDirectory(getBasedir() + "/src/main/java"); build.setOutputDirectory(getBasedir() + "/target/classes"); build.setTestSourceDirectory(getBasedir() + "/src/test/java"); build.setTestOutputDirectory(getBasedir() + "/target/test-classes"); setBuild(build); List compileSourceRoots = new ArrayList(); compileSourceRoots.add(getBasedir() + "/src/main/java"); setCompileSourceRoots(compileSourceRoots); List testCompileSourceRoots = new ArrayList(); testCompileSourceRoots.add(getBasedir() + "/src/test/java"); setTestCompileSourceRoots(testCompileSourceRoots); }
Example 2
Source File: TestProjectStub.java From steady with Apache License 2.0 | 4 votes |
/** * Default constructor */ public TestProjectStub(String projectPath, String pomFile) { this.projectPath = projectPath; MavenXpp3Reader pomReader = new MavenXpp3Reader(); Model model; try { model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), pomFile))); setModel(model); } catch (Exception e) { throw new RuntimeException(e); } setGroupId(model.getGroupId()); setArtifactId(model.getArtifactId()); setVersion(model.getVersion()); setName(model.getName()); setUrl(model.getUrl()); setPackaging(model.getPackaging()); Build build = new Build(); build.setFinalName(model.getArtifactId()); build.setDirectory(getBasedir() + "/target"); build.setSourceDirectory(getBasedir() + "/src/main/java"); build.setOutputDirectory(getBasedir() + "/target/classes"); build.setTestSourceDirectory(getBasedir() + "/src/test/java"); build.setTestOutputDirectory(getBasedir() + "/target/test-classes"); build.setPlugins(model.getBuild().getPlugins()); build.setExtensions(model.getBuild().getExtensions()); setBuild(build); List compileSourceRoots = new ArrayList(); compileSourceRoots.add(getBasedir() + "/src/main/java"); setCompileSourceRoots(compileSourceRoots); List testCompileSourceRoots = new ArrayList(); testCompileSourceRoots.add(getBasedir() + "/src/test/java"); setTestCompileSourceRoots(testCompileSourceRoots); }
Example 3
Source File: ProjectStub.java From dependency-mediator with Apache License 2.0 | 4 votes |
/** * Default constructor */ public ProjectStub() { MavenXpp3Reader pomReader = new MavenXpp3Reader(); Model model; try { model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml"))); setModel(model); } catch (Exception e) { throw new RuntimeException(e); } Artifact artifact = new ArtifactStub(); artifact.setArtifactId(model.getArtifactId()); artifact.setGroupId(model.getGroupId()); artifact.setVersion(model.getVersion()); setArtifact(artifact); setGroupId(model.getGroupId()); setArtifactId(model.getArtifactId()); setVersion(model.getVersion()); setName(model.getName()); setUrl(model.getUrl()); setPackaging(model.getPackaging()); Build build = new Build(); build.setFinalName(model.getArtifactId()); build.setDirectory(getBasedir() + "/target"); build.setSourceDirectory(getBasedir() + "/src/main/java"); build.setOutputDirectory(getBasedir() + "/target/classes"); build.setTestSourceDirectory(getBasedir() + "/src/test/java"); build.setTestOutputDirectory(getBasedir() + "/target/test-classes"); setBuild(build); List<String> compileSourceRoots = new ArrayList<String>(); compileSourceRoots.add(getBasedir() + "/src/main/java"); setCompileSourceRoots(compileSourceRoots); List<String> testCompileSourceRoots = new ArrayList<String>(); testCompileSourceRoots.add(getBasedir() + "/src/test/java"); setTestCompileSourceRoots(testCompileSourceRoots); }