Maven-jetty-plugin hot deploy multi module project - deployment

I am working on alfresco and I have a multi module project that looks like that :
- parentModule
- alfrescoModule
- shareModule
- ampAlfrescoModule (contains java classes)
- ampShareModule
- runnerModule
I would like to hot redeploy modified classes from the ampAlfrescoModule
Here is the content of runnerModule's pom :
<profiles>
<profile>
<id>run</id>
<activation>
<property>
<name>run</name>
</property>
</activation>
<properties>
<runner.host>127.0.0.1</runner.host>
<runner.port>8080</runner.port>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<executions>
<execution>
<id>run</id>
<goals>
<goal>run</goal>
</goals>
<phase>integration-test</phase>
</execution>
</executions>
<configuration>
//this is what i've tested but it doesn't work
<scanIntervalSeconds>5</scanIntervalSeconds>
<classesDirectory>../ampAlfrescoProject/target/classes</classesDirectory>
<!-- Following 3 properties set an empty ROOT context, which is mandatory
to run jetty:run plugin -->
<contextPath>/</contextPath>
<webAppSourceDirectory>.</webAppSourceDirectory>
<webXml>jetty/root-web.xml</webXml>
<contextHandlers>
<contextHandler implementation="org.mortbay.jetty.webapp.WebAppContext">
<war>${project.basedir}/../alfrescoProject/target/alfrescoProject.war</war>
<contextPath>/alfresco</contextPath>
</contextHandler>
<contextHandler implementation="org.mortbay.jetty.webapp.WebAppContext">
<war>${alfresco.solr.dir}/apache-solr-1.4.1-overlay.war</war>
<contextPath>/solr</contextPath>
</contextHandler>
<contextHandler implementation="org.mortbay.jetty.webapp.WebAppContext">
<war>${project.basedir}/../shareProject/target/shareProject.war</war>
<contextPath>/share</contextPath>
</contextHandler>
</contextHandlers>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
It deploys 3 wars in jetty. I have to point to ampAlfrescoModule/target/classes with classesDirectory but it doesn't work.
This is the ouptut I get :
[INFO] restarting org.mortbay.jetty.plugin.Jetty6PluginWebAppContext#986d0e{/,C:\Users\..\workspace\AllInOneAdvancedSearch\runnerProject}
[INFO] Webapp source directory = C:\Users\..\workspace\AllInOneAdvancedSearch\runnerProject
[INFO] Reload Mechanic: automatic
[INFO] Classes directory C:\Users\..\workspace\AllInOneAdvancedSearch\ampAlfrescoProject\target\classes
[INFO] Context path = /
[INFO] Tmp directory = determined at runtime
[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] web.xml file = C:\Users\..\workspace\AllInOneAdvancedSearch\runnerProject\jetty\root-web.xml
[INFO] Webapp directory = C:\Users\..\workspace\AllInOneAdvancedSearch\runnerProject
[INFO] Reconfiguring scanner after change to pom.xml ...
2013-05-27 10:30:51.956:INFO::No Transaction manager found - if your webapp requires one, please configure one.
[INFO] Restart completed at Mon May 27 10:30:51 CEST 2013
When i run mvn compile my classes are not updated on the server, changes are not detected
Any help would be appreciated, thx

Related

Maven pom.xml for MATLAB compiler project

I have a Tomcat servlet project that requires a MATLAB jar generated by mcc. I have implemented a mojo plugin (mcc-maven-plugin) that generates the jar. It simply takes the specifications from a pom and creates a MATLAB command of the form:
cd '/home/jeffemandel/webpropofolmm/matlab/src/main/matlab';mcc -W 'java:webpropofol_java,loadServlet' -d '/home/jeffemandel/webpropofolmm/matlab/target' class{loadServlet:loadServlet.m} class{locServlet:locServlet.m} class{testStruct:testStruct.m}
This generates the file /home/jeffemandel/webpropofolmm/matlab/target/webpropofol_java.jar
Note that target must exist for mcc to work.
I need this file in my main project, but it is resource-intensive to generate the jar every time I make a minor tweak to the UI (which has a small amount of Java and a lot of HTML, css, and javascript). My confusion point is how to generate a jar that doesn't depend on any Java code. Here is my pom.xml:
<?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>org.jeffmandel.webpropofol</groupId>
<artifactId>optimaltiva</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javabuilder</groupId>
<artifactId>javabuilder</artifactId>
<version>9.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<tasks>
<mkdir dir="${project.build.directory}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jeffmandel</groupId>
<artifactId>mcc-maven-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>mcc</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<packageName>webpropofol_java</packageName>
<className>loadServlet</className>
<classes>
<loadServlet>loadServlet.m</loadServlet>
<locServlet>locServlet.m</locServlet>
<testStruct>testStruct.m</testStruct>
</classes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<groupId>org.jeffmandel.webpropofol</groupId>
<artifactId>optimaltiva</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<file>${project.build.directory}/webpropofol_java.jar</file>
<generatePom>true</generatePom>
</configuration>
<executions>
<execution>
<id>install-jar-lib</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>install</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
When I run mvn compile, this is what I get:
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------< org.jeffmandel.webpropofol:optimaltiva >---------------
[INFO] Building optimaltiva 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # optimaltiva ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jeffemandel/webpropofolmm/matlab/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # optimaltiva ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-antrun-plugin:1.4:run (default) # optimaltiva ---
project.artifactId
[INFO] Executing tasks
[INFO] Executed tasks
[INFO]
[INFO] --- mcc-maven-plugin:0.0.1-SNAPSHOT:mcc (default) # optimaltiva ---
[INFO] cd '/home/jeffemandel/webpropofolmm/matlab/src/main/matlab';mcc -W 'java:webpropofol_java,loadServlet' -d '/home/jeffemandel/webpropofolmm/matlab/target' class{loadServlet:loadServlet.m} class{locServlet:locServlet.m} class{testStruct:testStruct.m}
[INFO] Loading source files for package webpropofol_java...
Constructing Javadoc information...
Standard Doclet version 1.8.0_221
Building tree for all the packages and classes...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/loadServlet.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/loadServletRemote.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/locServlet.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/locServletRemote.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/testStruct.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/testStructRemote.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/Webpropofol_javaMCRFactory.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/package-frame.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/package-summary.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/package-tree.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/constant-values.html...
Building index for all the packages and classes...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/overview-tree.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/index-all.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/deprecated-list.html...
Building index for all classes...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/allclasses-frame.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/allclasses-noframe.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/index.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/help-doc.html...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.215 s
[INFO] Finished at: 2020-12-12T22:26:54-05:00
[INFO] -----
The problem is that every time I run mvn compile it generates the jar, rather than seeing that the source files haven't changed so don't regenerate the jar. My ultimate goal is to have one project that contains the matlab and servlet.
I did some more reading and figured out that it was the responsibility of the mojo plugin to figure out whether recompilation was needed. MATLAB needs to rebuild the entire jar even if only a single file changes, so I added the following code to my mojo plugin:
import org.apache.commons.io.filefilter.AgeFileFilter;
import java.io.FileFilter;
File myJar = new File(outputDirectory + File.separator + packageName + ".jar");
AgeFileFilter myFilter = new AgeFileFilter(myJar, false);
File source = new File(sourceDirectory);
File[] files = source.listFiles((FileFilter) myFilter);
if (files.length==0) {
getLog().info("Project up to date");
} else {
...
}
This does the trick.

How to display maven properties in Eclipse?

How to display maven properties in Eclipse?
The pom below, based on antrun plugin is not work:
<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>Test_DisplayMavenVariables</groupId>
<artifactId>Test_DisplayMavenVariables</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<testproperty>This is a test property</testproperty>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Displaying value of 'testproperty' property</echo>
<echo>[testproperty] ${testproperty}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
UPDATE
If ran to goal "validate", the output is following:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Test_DisplayMavenVariables 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.110s
[INFO] Finished at: Sun Mar 23 15:22:00 MSK 2014
[INFO] Final Memory: 4M/183M
[INFO] ------------------------------------------------------------------------
You have put the antrun definition inside a pluginManagement block.
pluginManagement means: "if someone uses this plugin, he will do it in the following way..."
In your example, no one uses the plugin, since there is no normal plugin definition. Remove <pluginManagement> and </pluginManagement> from your pom, and it will work.

Trouble when importing a maven project into eclipse kepler (swagger for jersey rest)

I have created a rest webservice with jersey. I like to add swagger to my project to create documentation for the rest interface. As an example i downloaded a rest project with swagger. It is a maven project.
I installed maven on ubuntu & installed maven plugin into eclipse,
After a Maven clean, maven install & maven build on the project.
i get a few errors in console:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
In stackoverflow i see that someone has added manually this jar file?
Is it not a job for maven, because the dependency is in the pom?
--------------------------------------
...
2013-12-25 20:32:55.209:INFO:oejs.Server:jetty-8.1.11.v20130520
2013-12-25 20:32:56.168:WARN:oejw.WebAppContext:Failed startup of context o.m.j.p.JettyWebAppContext{/api,file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples/java-jaxrs/target/swagger-java-sample-app_2.9.1-1.3.0-RC1/},file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples/java-jaxrs/target/swagger-java-sample-app_2.9.1-1.3.0-RC1/
java.util.zip.ZipException: invalid entry size (expected 6164 but got 4968 bytes)
at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:386)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:156)
at java.util.jar.JarInputStream.read(JarInputStream.java:195)
at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:100)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:78)
at java.util.jar.JarInputStream.getNextEntry(JarInputStream.java:130)
at java.util.jar.JarInputStream.getNextJarEntry(JarInputStream.java:167)
at org.eclipse.jetty.webapp.JarScanner.matched(JarScanner.java:162)
at org.eclipse.jetty.util.PatternMatcher.matchPatterns(PatternMatcher.java:100)
at org.eclipse.jetty.util.PatternMatcher.match(PatternMatcher.java:82)
at org.eclipse.jetty.webapp.JarScanner.scan(JarScanner.java:84)
.....
INFO] Started Jetty Server
[INFO]
[INFO] --- maven-failsafe-plugin:2.6:integration-test (default) # swagger-java-sample-app_2.9.1 ---
[INFO] No tests to run.
[INFO]
[INFO] --- jetty-maven-plugin:8.1.11.v20130520:stop (stop-jetty) # swagger-java-sample-app_2.9.1 ---
[INFO]
[INFO] --- maven-source-plugin:2.1.2:jar-no-fork (attach-sources) # swagger-java-sample-app_2.9.1 ---
[INFO]
[INFO] --- maven-javadoc-plugin:2.7:jar (attach-javadocs) # swagger-java-sample-app_2.9.1 ---
2013-12-25 20:32:56.778:INFO:oejsh.ContextHandler:stopped o.m.j.p.JettyWebAppContext{/api,file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples
....
I get also this errors in Problems tab:
'/home/scorpio/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.1.5/jackson-databind-2.1.5.jar' in project 'swagger-java-sample-app_2.9.1' cannot be read or is not a valid ZIP file swagger-java-sample-app_2.9.1 Build path Build Path Problem
maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e. pom.xml /swagger-java-sample-app_2.9.1 line 2 Maven Project Build Lifecycle Mapping Problem
Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.1.0:add-source (execution: default, phase: initialize) pom.xml /swagger-java-sample-app_2.9.1 line 2 Maven Project Build Lifecycle Mapping Problem
Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.1.0:testCompile (execution: default, phase: test-compile) pom.xml /swagger-java-sample-app_2.9.1 line 2 Maven Project Build Lifecycle Mapping Problem
-------
pom 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/maven-v4_0_0.xsd">
<parent>
<groupId>com.wordnik</groupId>
<artifactId>swagger-project_2.9.1</artifactId>
<version>1.3.0-RC1</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>swagger-java-sample-app_2.9.1</artifactId>
<packaging>war</packaging>
<name>swagger-java-jaxrs-app</name>
<version>1.3.0-RC1</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-version}</version>
<configuration>
<webAppConfig>
<contextPath>/api</contextPath>
</webAppConfig>
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
<webDefaultXml>${project.basedir}/conf/jetty/webdefault.xml</webDefaultXml>
<stopPort>8079</stopPort>
<stopKey>stopit</stopKey>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>8002</port>
<maxIdleTime>60000</maxIdleTime>
<confidentialPort>8443</confidentialPort>
</connector>
</connectors>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.9.1</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.1</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
</dependencies>
</project>
Could someone give some extra info so that i can go on?
Thx
There are multiple issues according to your logs
2013-12-25 20:32:56.168:WARN:oejw.WebAppContext:Failed startup of context o.m.j.p.JettyWebAppContext{/api,file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples/java-jaxrs/target/swagger-java-sample-app_2.9.1-1.3.0-RC1/},file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples/java-jaxrs/target/swagger-java-sample-app_2.9.1-1.3.0-RC1/
java.util.zip.ZipException: invalid entry size (expected 6164 but got 4968 bytes)
This simply means that th ZIP file is invalid/improper. Either it was not creates properly or an inturrupt occured during download. I would recommend deleting the file and re-creating/re-donwloading it
'/home/scorpio/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.1.5/jackson-databind-2.1.5.jar' in project 'swagger-java-sample-app_2.9.1' cannot be read or is not a valid ZIP file swagger-java-sample-app_2.9.1 Build path Build Path Problem
Delete this file and re-acquire it
maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e. pom.xml /swagger-java-sample-app_2.9.1 line 2 Maven Project Build Lifecycle Mapping Problem
Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.1.0:add-source (execution: default, phase: initialize) pom.xml /swagger-java-sample-app_2.9.1 line 2 Maven Project Build Lifecycle Mapping Problem
Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.1.0:testCompile (execution: default, phase: test-compile) pom.xml /swagger-java-sample-app_2.9.1 line 2 Maven Project Build Lifecycle Mapping Problem
All these errors points to one things, the limitation of the m2e eclipse plugin. There are certain plugin goals that are not covered by m2e plugin. THeres nothing much that you can do about it except make sure to verify that the wars are made properly with each build.

Errors when using maven plugin for Weblogic deployment

I have been trying to deploy application to Weblogic 10.3.6 using maven
I have created weblogic plugin for maven as mentioned in this article.
I have added the following to pom.xml
<build>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.3</version>
<configuration>
<goalPrefix>weblogic</goalPrefix>
</configuration>
</plugin>
<plugin>
<groupId>weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>10.3.6.0</version>
<configuration>
<adminurl>t3://localdomain:7001</adminurl>
<user>weblogic</user>
<password>password</password>
<name>wldemo</name>
<remote>true</remote>
<upload>true</upload>
<targets>AdminServer</targets>
</configuration>
<executions>
<execution>
<id>deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<source>target/EmployeesApp-1.0-SNAPSHOT.war</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
When I did mvn com.oracle.weblogic:weblogic-maven-plugin:deploy I am getting the following errors, how can I resolve these errors?
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:10.3.6.
0:deploy (default-cli) on project EmployeesApp: The parameters 'source' for goal
com.oracle.weblogic:weblogic-maven-plugin:10.3.6.0:deploy are missing or invali
d
You have specified the source parameter in the execution configuration, so in order to make it taken into account you should invoke this particular execution. It can be done using the phase key you specified, so e.g.:
mvn integration-test
Maven will go through the whole lifecycle and on the pre-integration-test test phase (which precedes the integration-test one) it will run the execution of weblogic-maven-plugin you configured.

Trying to get ScalaTest working: "There are no tests to run" when doing "mvn test"

Edit: I finally got it to work!!!
It needed a combination of JUnit in the pom.xml, and three statements in my .scala:
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
#RunWith(classOf[JUnitRunner])
For some reason, trying to configure Surefire makes the tests stop running again.
I'm coding in IntelliJ, trying to get a simple ScalaTest test running via a Maven (mvn test) build process. There aren't any errors, but unfortunately no tests run either.
Here is my .scala file:
import org.scalatest.FunSuite
import org.scalatest.BeforeAndAfter
class ExampleSuite extends FunSuite with BeforeAndAfter {
before {
println("Doing setup tasks...")
}
test("Example test of checking the browser title") {
val expected_title = "Company Platform"
var actual_title = "Company Platform"
assert(actual_title == expected_title)
}
after {
println("Doing teardown tasks...")
}
}
Here's the Maven output:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for JoeTestDemo:JoeTestDemo:jar:1.0
[WARNING] 'build.plugins.plugin.version' for org.scala-tools:maven-scala-plugin is missing. # line 42, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building JoeTestDemo 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) # JoeTestDemo ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # JoeTestDemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:compile (default) # JoeTestDemo ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[WARNING] No source files found.
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) # JoeTestDemo ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Joeshaver/Projects/JoeTestDemo/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # JoeTestDemo ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:testCompile (default) # JoeTestDemo ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) # JoeTestDemo ---
[INFO] Surefire report directory: /Users/Joeshaver/Projects/JoeTestDemo/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.368s
[INFO] Finished at: Tue Oct 23 10:58:30 PDT 2012
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
Here is the pom.xml. I think my Maven Scala plugin might not be right:
<?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>JoeTestDemo</groupId>
<artifactId>JoeTestDemo</artifactId>
<version>1.0</version>
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</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>2.9.0-1</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.0-1</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDir>src/main/java</sourceDir>
<jvmArgs>
<jvmArg>-Xms64m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
You might want to use the scalatest-maven-plugin to run your scala tests.
Also make sure that you use the <scope>test</scope> for jars needed only for test purposes.
This is how I have defined my pom.xml for using ScalaTest:
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.stackoverflow</groupId>
<artifactId>Q13036561</artifactId>
<version>1.0-SNAPSHOT</version>
<name>${project.artifactId}-${project.version}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scala.version>2.9.2</scala.version>
<scalatest.version>2.0.M4</scalatest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.version}</artifactId>
<version>${scalatest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<id>scala-compile</id>
<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.7.2</version>
<executions>
<execution>
<id>default-test</id>
< ! - Disable the default-test by putting it in phase none - >
<phase>none</phase>
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0-M2</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<stdout>W</stdout> <!-- Skip coloring output -->
</configuration>
<executions>
<execution>
<id>scala-test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
As you can see I have also added a section that disables the surefire plugin if you really don't want to run it. It is commented in the above pom but if you want to disable the surefire plugin just uncomment that part.
I am using IntelliJ too and there are no problems at all with this combination. Just run the tests from within IntelliJ or by using mvn test, they will both work.
If you're running on Maven, then you'll either have to annotate your test class(es) with
#RunWith(classOf[JUnitRunner])
This would require you having JUnit as a dependency. Or you could use the ScalaTest Maven Plugin (haven't used it myself though).
Adding to Blake's answer, besides #RunWith(classOf[JUnitRunner]) you might also need to set the surefire as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<includes>
<include>**/*Suite.class</include>
<include>**/*Test.class</include>
<include>**/*Tests.class</include>
<include>**/*Spec.class</include>
<include>**/*Specs.class</include>
</includes>
</configuration>
</plugin>
Here's one of my Maven projects which tests just fine by ScalaTest without any special plugin: https://github.com/nikita-volkov/sext/