Need an older version of apache commons lang3 in Azure Artifacts - azure-devops

I need an older version of Apache Commons Lang3 in Azure Artifacts. I need version 3.8.1 (last version that supports Java 7) but it's not listed. Is there a way to get Azure Artifacts to grab a specific version from Maven Central?

I ended up generating a new access token for the settings file and it worked. No where in the logs did it indicate there was an error connecting to the Artifacts feed. It just quietly rolled over to grab everything from Central.

Since the package is public, you just need at least one time to use, and then the package version will be listed in the artifact feed.
It is successfully to get the specific version package on my side:
How I achieve that:
POM.xml on my side:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>111</version>
<name>demo</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<repositories>
<repository>
<id>BowmanCP</id>
<url>https://pkgs.dev.azure.com/BowmanCP/_packaging/BowmanCP/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>BowmanCP</id>
<url>https://pkgs.dev.azure.com/BowmanCP/_packaging/BowmanCP/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
The key is 3 part:
1, repositories part
<repositories>
<repository>
<id>BowmanCP</id>
<url>https://pkgs.dev.azure.com/BowmanCP/_packaging/BowmanCP/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
2, distributionManagement part
<distributionManagement>
<repository>
<id>BowmanCP</id>
<url>https://pkgs.dev.azure.com/BowmanCP/_packaging/BowmanCP/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>
3, dependencies part
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
</dependencies>
The previous 2 part comes from this place:
Push this Maven project to a repo in Azure DevOps, and then use below yml to install the package:
trigger:
- none
pool:
vmImage: ubuntu-latest
steps:
- task: MavenAuthenticate#0 # This step is changing the setting.xml in agent account.
inputs:
artifactsFeeds: 'BowmanCP'
- task: Maven#3 #This step will install the specific maven package mentioned in POM.xml,
inputs:
mavenPomFile: 'demo/pom.xml'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
mavenVersionOption: 'Default'
mavenOptions: '-Xmx3072m'
mavenAuthenticateFeed: true
effectivePomSkip: false
sonarQubeRunAnalysis: false
This is my repo structure:
You can refer to this official document:
https://learn.microsoft.com/en-us/azure/devops/artifacts/maven/upstream-sources?view=azure-devops

Related

How to resolve 'Offline / Missing artifact org.geotools:gt-shapefile:jar:17-SNAPSHOT' in Maven?

I'm new to Maven and am trying to create a simple Maven project given in geotools.org
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- use the latest snapshot -->
<geotools.version>17-SNAPSHOT</geotools.version>
</properties>
<groupId>org.geotools</groupId>
<artifactId>tutorial</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tutorial</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-swing</artifactId>
<version>${geotools.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>http://repo.boundlessgeo.com/main</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
The error I am getting is 'Offline / Missing artifact org.geotools:gt-shapefile:jar:17-SNAPSHOT'. How do I resolve this? I am using Eclipse Neon.1a Release (4.6.1).There is no option for selecting Project ‣ Update All Maven Dependencies. In some of the similar questions asked here it was recommended to change the repository URL. Which URL shall I change? Java.net repository OR Open Source Geospatial Foundation Repository OR Boundless Maven Repository?
It looks like the Boundless artifactory was down at that moment. For the time being you can use version 16-RC1 as the latest released version, 15.2 as the last stable release.
If you absolutely must be on the cutting edge, I'd recommend downloading/cloning master and building it locally.
I think that instead of ${geotools.version} you should place a real version number of the project, like 15.1
I am not sure though if that's the problem
Also, you might want to consider changing to Gradle build. I think it is a lot simpler

Maven dependency error (artifact)

I'm trying to install Fenix framework with maven adding the following dependence:
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-infinispan</artifactId>
<version>2.0-cloudtm</version>
</dependency>
gives the following error: missing artifact ...
My POM.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.isban.test</groupId>
<artifactId>fenixtest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>fenixtest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-infinispan</artifactId>
<version>2.0-cloudtm</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<pluginRepositories>
<pluginRepository>
<id>fenix-ashes-maven-repository</id>
<url>https://fenix-ashes.ist.utl.pt/maven-public</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>fenix-ashes-maven-repository</id>
<url>https://fenix-ashes.ist.utl.pt/maven-public</url>
</repository>
</repositories>
</project>
Official documentation : https://fenix-framework.github.io/Usage.html
Does anyone know what I'm doing wrong?
Those artifacts are not available on Maven Central but on a specific Fénix repository. From the official page:
These artifacts are available via the Fénix Framework Nexus repository, so you need to add it to your configuration:
<pluginRepositories>
<pluginRepository>
<id>fenix-ashes-maven-repository</id>
<url>https://fenix-ashes.ist.utl.pt/maven-public</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>fenix-ashes-maven-repository</id>
<url>https://fenix-ashes.ist.utl.pt/maven-public</url>
</repository>
</repositories>
There is actually a typo in that page, that I corrected here: the last element should be <repositories> and not <pluginRepositories>. Therefore, you need to add those repositories to your POM (or to your Maven settings).
The dependency
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-infinispan</artifactId>
<version>2.0-cloudtm</version>
</dependency>
is also incorrect from the documentation: that artifact indeed doesn't exist. The latest version is 2.6.2 and the artifact should be fenix-framework-backend-infinispan-code-generator, so you should have instead:
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-infinispan-code-generator</artifactId>
<version>2.6.2</version>
</dependency>

Unable to execute Spray Examples | Maven dependency error

I am just trying to have hands on Spray library however am not able to execute its examples due to maven dependency.
As provided in docs I have defined Spray repository as follows:
<repositories>
<repository>
<id>sprayrepo</id>
<name>spray repo</name>
<url>http://repo.spray.io/</url>
<layout>default</layout>
</repository>
</repositories>
Then I have defined its dependency as follows:
<dependency>
<groupId>io.spray</groupId>
<artifactId>spray-http</artifactId>
<version>1.1-M7</version>
</dependency>
<dependency>
<groupId>io.spray</groupId>
<artifactId>spray-httpx</artifactId>
<version>1.1-M7</version>
</dependency>
<dependency>
<groupId>io.spray</groupId>
<artifactId>spray-util</artifactId>
<version>1.1-M7</version>
</dependency>
<dependency>
<groupId>com.chuusai</groupId>
<artifactId>shapeless_2.9.2</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
However when I try to execute to maven install, I face following error:
[ERROR] Failed to execute goal on project spray-test1: Could not
resolve dependencies for project
org.spray:spray-test1:jar:1.0-SNAPSHOT: Failed to collect dependencies
for [io.spray:spray-http:jar:1.1-M7 (compile),
io.spray:spray-httpx:jar:1.1-M7 (compile),
io.spray:spray-util:jar:1.1-M7 (compile),
com.chuusai:shapeless_2.9.2:jar:1.2.0 (compile)]: Failed to read
artifact descriptor for io.spray:spray-http:jar:1.1-M7: Could not
transfer artifact io.spray:spray-http:pom:1.1-M7 from/to sprayrepo
(http://repo.spray.io/): connection timed out to
http://repo.spray.io/io/spray/spray-http/1.1-M7/spray-http-1.1-M7.pom
-> [Help 1] [ERROR]
Any Pointers or suggestions will be highly appreciated.
Thanks
Try this:
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.tools.version>2.10</scala.tools.version>
<scala.version>2.10.2</scala.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>io.spray</groupId>
<artifactId>spray-can</artifactId>
<version>1.1-M8</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2_${scala.tools.version}</artifactId>
<version>1.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.tools.version}</artifactId>
<version>2.0.M6-SNAP8</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.1.3</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<!-- If you have classpath issue like NoDefClassError,... -->
<!-- useManifestOnlyJar>false</useManifestOnlyJar -->
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>SonatypeNexusSnapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>FuseSourceSnapshotRepository</id>
<name>FuseSource Snapshot Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>ScalaToolsMaven2Repository</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases/</url>
</repository>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
<repository>
<id>sprayrepo</id>
<name>spray repo</name>
<url>http://repo.spray.io/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>

How to add Spark to Maven project in Eclipse?

I would like to start Spark project in Eclipse using Maven.
I've installed m2eclipse and I have a working HelloWorld Java application in my Maven project.
I would like to use Spark framework and I'm following directions from the official site.
I've added Spark repository to my pom.xml:
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
And then the dependency:
<dependency>
<groupId>spark</groupId>
<artifactId>spark</artifactId>
<version>0.9.9.4-SNAPSHOT</version>
</dependency>
But I'm getting an error in Eclipse:
Missing artifact spark:spark:jar:0.9.9.4-SNAPSHOT
How can I resolve this issue? I don't want to download Spark's jar file and place in the local repository.
This is my pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>Spark1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Spark1</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
<dependencies>
<!-- (...) -->
<dependency>
<groupId>spark</groupId>
<artifactId>spark</artifactId>
<version>0.9.9.4-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Currently no repository is required to add for Spark library loading
You just need to add
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.6.0</version>
</dependency>
And that's it.
Useful tutorials to play with is here
The repository block needs to be wrapped in a repositories block:
<repositories>
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
</repositories>
Reason for failure is 0.9.9.4-SNAPSHOT is not available.Below is the list of the snapshots available. Use one among them based on your requirement.
0.9.8-SNAPSHOT/ Sat May 21 21:54:23 UTC 2011
0.9.9-SNAPSHOT/ Mon May 23 10:57:38 UTC 2011
0.9.9.1-SNAPSHOT/ Thu May 26 09:47:03 UTC 2011
0.9.9.3-SNAPSHOT/ Thu Sep 01 07:53:59 UTC 2011
Thanks,
Sankara Reddy
I had run into same issue because initially I started with different repository url for spark and then to use earlier version I changed the repository url. Some how it didn't seem to come into effect until I changed the repository id. Try changing the repository id.
Could be bug in maven because running maven from console also couldn't resolve the dependency without updating the id.
please add the repository , tag inside the repositories tag like below
<repositories>
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
</repositories>
The last versions (2.1 and later) of Spark only need the dependency defined inside the pom.xml file
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.1</version>
</dependency>
the repository definition is not longer required
use this latest repository.
http://mvnrepository.com/artifact/org.apache.spark/spark-core_2.10/1.6.0
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.6.0</version>
</dependency>
use this, and also make sure you change spark library to version 2.11.x in eclipse project build path
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.spark-scala</groupId>
<artifactId>spark-scala</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>Spark in Scala</description>
<inceptionYear>2010</inceptionYear>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.tools.version>2.10</scala.tools.version>
<!-- Put the Scala version of the cluster -->
<scala.version>2.10.4</scala.version>
</properties>
<!-- repository to add org.apache.spark -->
<repositories>
<repository>
<id>cloudera-repo-releases</id>
<url>https://repository.cloudera.com/artifactory/repo/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
<!-- "package" command plugin -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
</project>

Scala simple dummy project

Currently my whole work cycle is:
edit foo.scala
fsc foo.scala && scala -cp . FooMain
But my project is getting bigger and I would like to split files, make unit tests, etc.
But I'm too lazy for reading sbt documentation and doing whatever needs to be done to get a sbt's "Makefile". Similarly for unit tests (there are so many frameworks, which to choose?)
What would make my day is a simple zipped dummy project with a dummy unit tests using sbt.
Do you know whether such thing exists?
Well, you should use SBT. You don't need to write anything for it: it will create everything you need for a basic project, and only ask you what is the project name and what version of Scala you'll be using.
After that, just put the files in the correct places. Look up the directory layout, though the short answer is main source files in src/main/scala and test source files in src/test/scala. You will have to create a very small "makefile" to get a test library in, though.
Updated answer (2016)
These days, you have the Giter8 project, combined with the sbt’s launcher version 0.13.13 or above, and its command new.
sbt new ...
Original answer (2010)
Yes, such a template project, based on sbt, complete with scala tests, exists:
see Get Started With Scala, Sbt And Eclipse and its template project.
1) Clone OR download/extract source from sbt-console-template
% git clone git://github.com/mgutz/sbt-console-template.git your-project
2) From sbt console
# update dependencies
> update
# run project
> run
# test project continuously
> ~test
# eclipsify
> eclipse
(the "eclipse" part is optional, and only here if you want to generate a Scala eclipse project from your sbt project)
Another Scala template project:
Build a mixed Scala 2.8/Java application from scratch with Maven
It uses the following template (here is the zip file with the full Maven-Scala project):
+-scalajavatut/
+-pom.xml
+-src/
| +-main/
| | +-java/
| | | +-de/
| | | +-mackaz/
| | | +-HelloScala.java
| | +-scala/
| | +-de/
| | +-mackaz/
| | +-App.scala
| +-test/
| +-scala/
| +-de/
| +-mackaz/
| +-AppTest.scala
| +-MySpec.scala
And the following pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.mackaz</groupId>
<artifactId>tutorial1</artifactId>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2008</inceptionYear>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scala.version>2.8.0-SNAPSHOT</scala.version>
</properties>
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
<!-- Scala 2.8 Latest -->
<repository>
<id>scala-tools.org.snapshots</id>
<name>Scala Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-snapshots</url>
<snapshots />
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
<!-- Specs (Behavior Driven Testing through JUnit) -->
<dependency>
<groupId>org.scala-tools.testing</groupId>
<artifactId>specs</artifactId>
<version>1.6.1-2.8.0.Beta1-RC1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.13.1</version>
<executions>
<execution>
<id>compile</id>
<goals><goal>compile</goal></goals>
<phase>compile</phase>
</execution>
<execution>
<id>test-compile</id>
<goals><goal>testCompile</goal></goals>
<phase>test-compile</phase>
</execution>
<execution>
<phase>process-resources</phase>
<goals><goal>compile</goal></goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<launchers>
<launcher>
<id>myLauncher</id>
<mainClass>de.mackaz.App</mainClass>
</launcher>
</launchers>
<args>
<arg>-target:jvm-1.5</arg>
<!-- to support mix java/scala only -->
<arg>-make:transitivenocp</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<downloadSources>true</downloadSources>
<buildcommands>
<buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>
</buildcommands>
<additionalProjectnatures>
<projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>
</additionalProjectnatures>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
You can run it with:
mvn scala:run
and at the end of the output you should see
[INFO] launcher 'myLauncher' selected => de.mackaz.App
Hello from Java
Scala says: Hello from Scala!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Wed Mar 24 18:14:22 CET 2010
[INFO] Final Memory: 14M/33M
[INFO] ------------------------------------------------------------------------
In Fanf's blog, Francois Armand presents:
Maven2 bootstrap pom.xml for Scala with SLF4J and no-commons-logging
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>test</artifactId>
<packaging>jar</packaging>
<version>0.1-SNAPSHOT</version>
<properties>
<!-- UTF-8 for everyone -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Other general properties -->
<slf4j-version>1.6.0</slf4j-version>
<logback-version>0.9.20</logback-version>
<scala-version>2.8.0.RC2</scala-version>
<scala-maven-plugin-version>2.13.1</scala-maven-plugin-version>
</properties>
<description>
Starting pom
</description>
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
<repository>
<id>scala-snapshots.org</id>
<name>Scala-tools Maven2 Repository snapshots</name>
<url>http://scala-tools.org/repo-snapshots</url>
</repository>
<repository>
<id>no-commons-logging</id>
<name>No-commons-logging Maven Repository</name>
<layout>default</layout>
<url>http://no-commons-logging.zapto.org/mvn2</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
<snapshots><enabled>false</enabled></snapshots>
</pluginRepository>
<pluginRepository>
<id>scala-snapshots.org</id>
<name>Scala-tools Maven2 Repository snapshots</name>
<url>http://scala-tools.org/repo-snapshots</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<args>
<arg>-target:jvm-1.5</arg>
<arg>-make:transitivenocp</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
<jvmArgs>
<jvmArg>-client</jvmArg>
<jvmArg>-Xmx1G</jvmArg>
</jvmArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.6</source>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala-version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6</version>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<!--
All the following is related to our will to NOT use Commong-logging
-->
<!-- use no-commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>99.0-does-not-exist</version>
</dependency>
<!-- no-commons-logging-api, if you need it -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>99.0-does-not-exist</version>
</dependency>
<!-- the slf4j commons-logging replacement -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j-version}</version>
</dependency>
<!-- the other slf4j jars -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
</dependency>
<!-- using slf4j native backend -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback-version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-version}</version>
</dependency>
</dependencies>
</project>