Publisher artifactArchiver = new ArtifactArchiver("dir/", "", false);
project.getPublishersList().replaceBy(Collections.singleton(artifactArchiver));
project.getBuildersList().replaceBy(Collections.singleton(new TestBuilder() {
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
FilePath dir = build.getWorkspace().child("dir");
dir.child("subdir1").mkdirs();
FilePath subdir2 = dir.child("subdir2");
subdir2.mkdirs();
subdir2.child("file").write("content", "UTF-8");
return true;
}