protected void setSourceDirectoryForAllMojo(File newSourceDirectory) {
		final List<String> sourceRoots = this.mavenProject.getCompileSourceRoots();
		getLog().debug("Old source roots: " + sourceRoots.toString()); //$NON-NLS-1$
		final Iterator<String> iterator = sourceRoots.iterator();
		final String removableSourcePath = this.javaSourceRoot.getAbsolutePath();
		getLog().debug("Removable source root: " + removableSourcePath); //$NON-NLS-1$
		String path;
		while (iterator.hasNext()) {
			path = iterator.next();
			if (path != null && path.equals(removableSourcePath)) {
				getLog().debug("Removing source root: " + path); //$NON-NLS-1$
				iterator.remove();
			}
		}
		getLog().debug("Adding source root: " + newSourceDirectory.getAbsolutePath()); //$NON-NLS-1$
		this.mavenProject.addCompileSourceRoot(newSourceDirectory.toString());
		this.sourceDirectory = newSourceDirectory;
	}
protected void setSourceDirectoryForAllMojo ( File newSourceDirectory ) { final List < String > sourceRoots = this . mavenProject . getCompileSourceRoots ( ) ; getLog ( ) . debug ( "Old source roots: " + sourceRoots . toString ( ) ) ; final Iterator < String > iterator = sourceRoots . iterator ( ) ; final String removableSourcePath = this . javaSourceRoot . getAbsolutePath ( ) ; getLog ( ) . debug ( "Removable source root: " + removableSourcePath ) ; String path ; while ( iterator . hasNext ( ) ) { path = iterator . next ( ) ; if ( path != null && path . equals ( removableSourcePath ) ) { getLog ( ) . debug ( "Removing source root: " + path ) ; iterator . remove ( ) ; } } getLog ( ) . debug ( "Adding source root: " + newSourceDirectory . getAbsolutePath ( ) ) ; this . mavenProject . addCompileSourceRoot ( newSourceDirectory . toString ( ) ) ; this . sourceDirectory = newSourceDirectory ; }
Replace the current source directory by the given directory.

<p>CAUTION: this function override the source directory for all
the Maven plugins. Invoking this function may cause failures
in other maven plugins.

@param newSourceDirectory the directory.