From c714261e3db45fc7f7d9793b56c724b0c73a5baa Mon Sep 17 00:00:00 2001 From: Christopher Hunt Date: Mon, 2 Sep 2013 11:41:59 +1000 Subject: [PATCH 1/2] Excluding IDE meta data from repo. --- .gitignore | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 571996be5..be5ce9914 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ project/project -project/target -target +.classpath +.project +.settings/ +.idea/ +*.iml +*.iws +.DS_Store +log/ +target/ +.cache From d0d118d27304a7b24f32a6566c194ca518647c70 Mon Sep 17 00:00:00 2001 From: Christopher Hunt Date: Mon, 2 Sep 2013 12:21:24 +1000 Subject: [PATCH 2/2] Filters out .pom, sources and javadoc from projectDependencyArtifacts. The presence of the pom.xml would cause the project's jar file to be overwritten given that the xml and the jar have the same name sans extension. The javadoc and source are not required for running the project (which I presume is the motivation behind determining these artefacts). --- .../typesafe/sbt/packager/archetypes/JavaApp.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaApp.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaApp.scala index 5bbf0efa7..671fbb268 100644 --- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaApp.scala +++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaApp.scala @@ -23,14 +23,13 @@ object JavaAppPackaging { // Here we record the classpath as it's added to the mappings separately, so // we can use its order to generate the bash/bat scripts. scriptClasspathOrdering := Nil, - // Note: This is sometimes on the classpath via depnedencyClasspath in Runtime. + // Note: This is sometimes on the classpath via dependencyClasspath in Runtime. // We need to figure out why sometimes the Attributed[File] is corrrectly configured // and sometimes not. scriptClasspathOrdering <+= (Keys.packageBin in Compile, Keys.projectID, Keys.artifact in Compile in Keys.packageBin) map { (jar, id, art) => jar -> ("lib/" + makeJarName(id.organization,id.name,id.revision, art.name)) }, - projectDependencyArtifacts <<= findDependencyProjectArtifacts, - //scriptClasspathOrdering <++= projectDependencyMappings, + projectDependencyArtifacts <<= findProjectDependencyArtifacts, scriptClasspathOrdering <++= (Keys.dependencyClasspath in Runtime, projectDependencyArtifacts) map universalDepMappings, scriptClasspathOrdering <<= (scriptClasspathOrdering) map {_.distinct}, mappings in Universal <++= scriptClasspathOrdering, @@ -141,7 +140,7 @@ object JavaAppPackaging { } } - def findDependencyProjectArtifacts: Initialize[Task[Seq[Attributed[File]]]] = + def findProjectDependencyArtifacts: Initialize[Task[Seq[Attributed[File]]]] = (sbt.Keys.buildDependencies, sbt.Keys.thisProjectRef, sbt.Keys.state) apply { (build, thisProject, stateTask) => val refs = thisProject +: dependencyProjectRefs(build, thisProject) // Dynamic lookup of dependencies... @@ -152,6 +151,11 @@ object JavaAppPackaging { p <- previous n <- next } yield (p ++ n) + .filterNot { + f => + val name = f.data.getName + name.endsWith(".pom") || name.endsWith("-sources.jar") || name.endsWith("-javadoc.jar") + } } allArtifactsTask }