Maven构建java和scala混编项目

Mixed Java/Scala Projects

The scala-maven-plugin is used for compiling/testing/running/documenting scala code in maven.

 分别设置好source folder :src/main/java,src/test/java,src/main/scala,src/test/scala

然后设置 pom 的dependences ,以及build中的内容即可。

详见:http://davidb.github.io/scala-maven-plugin/example_compile.html

setup

Place java sources files in :

src/main/java

Place java test sources files in :

src/test/java

Place scala sources files in :

src/main/scala

Place scala test sources files in :

src/test/scala

Make your pom file look similar to the following (this is what we use for integration testing):

          



	4.0.0

	sandbox
	testJavaAndScala
	1.0-SNAPSHOT
	Test for Java + Scala compilation
	Test for Java + Scala compilation

	
		
			org.scala-lang
			scala-library
			2.10.6
		
	

	
		
			
				
					net.alchim31.maven
					scala-maven-plugin
					3.2.1
				
				
					org.apache.maven.plugins
					maven-compiler-plugin
					2.0.2
				
			
		
		
			
				net.alchim31.maven
				scala-maven-plugin
				
					
						scala-compile-first
						process-resources
						
							add-source
							compile
						
					
					
						scala-test-compile
						process-test-resources
						
							testCompile
						
					
				
			
			
				org.apache.maven.plugins
				maven-compiler-plugin
				
					
						compile
						
							compile
						
					
				
			
		
	

你可能感兴趣的:(Maven构建java和scala混编项目)