Good day to you, Arnaud,
Your parameters must match your mojo's fields. And those fields must have an
"@parameter" annotation at the very least.
Since you have sourceOutput, testSource, filterIn, and lenient as
parameters, you should have those as fields as well. Something like
/**
* @parameter
*/
private File sourceOutput;
/**
* @parameter
*/
private File testSource;
/**
* @parameter
*/
private String filterIn;
/**
* @parameter
*/
private lenient;
Cheers,
Franz
Arnaud Bailly-3 wrote:
>
> Hello to all,
> I am using MavenEmbedder to do some integration testing for a maven
> plugin I wrote. It works quite fine but it seems that configuration
> inside execution are ignored. Any clue about that ?
>
> Here is the code snippet:
>
> package oqube.muse;
>
> import java.io.File;
> import java.util.Collections;
> import java.util.regex.Pattern;
>
> import junit.framework.TestCase;
>
> import oqube.muse.literate.LiterateMuse;
>
> import org.apache.maven.BuildFailureException;
> import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
> import org.apache.maven.artifact.resolver.ArtifactResolutionException;
> import org.apache.maven.cli.ConsoleDownloadMonitor;
> import org.apache.maven.embedder.MavenEmbedder;
> import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
> import org.apache.maven.embedder.PlexusLoggerAdapter;
> import org.apache.maven.lifecycle.LifecycleExecutionException;
> import org.apache.maven.monitor.event.DefaultEventMonitor;
> import org.apache.maven.monitor.event.EventMonitor;
> import org.apache.maven.project.DuplicateProjectException;
> import org.apache.maven.project.MavenProject;
> import org.apache.maven.project.ProjectBuildingException;
> import org.codehaus.plexus.util.dag.CycleDetectedException;
>
> /**
> * Integration testing class for literate muse plugin. This class run
> plugin
> * with projects using maven embedder and chekcs generation is ok.
> *
> * @author nono
> *
> */
> public class MavenPluginTest extends TestCase {
>
> private MavenEmbedder maven;
>
> protected void setUp() throws Exception {
> super.setUp();
> maven = new MavenEmbedder();
> ClassLoader classLoader =
> Thread.currentThread().getContextClassLoader();
> maven.setClassLoader(classLoader);
> maven.setLogger(new MavenEmbedderConsoleLogger());
> maven.start();
> }
>
> public void test01() throws CycleDetectedException,
> LifecycleExecutionException, BuildFailureException,
> DuplicateProjectException, ArtifactResolutionException,
> ArtifactNotFoundException, ProjectBuildingException {
> File targetDirectory = new File("target/test-classes/testPlugin01");
> File pomFile = new File(targetDirectory, "pom.xml");
> MavenProject pom = maven.readProjectWithDependencies(pomFile);
> EventMonitor eventMonitor = new DefaultEventMonitor(
> new PlexusLoggerAdapter(new MavenEmbedderConsoleLogger()));
> maven.execute(pom, Collections.singletonList("muse:publish"),
> eventMonitor,
> new ConsoleDownloadMonitor(), null, targetDirectory);
> // check generated data
> File gen = new
> File(targetDirectory,"target/generated-sources/literate/toto/Toto.java");
> assertTrue(gen.exists() && gen.length() > 0);
> }
> }
>
> and here is the test pom
>
> <?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>oqube</groupId>
> <artifactId>oqube-site-fr</artifactId>
> <packaging>jar</packaging>
> <version>1.1</version>
> <name>OQube Site Francais</name>
> <url>http://www.oqube.com/</url>
>
> <inceptionYear>2006</inceptionYear>
> <organization>
> <name>OQube</name>
> <url>http://www.oqube.com/contact.html</url>
> </organization>
>
> <build>
> <plugins>
>
> <!-- build french and english site -->
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-site-plugin</artifactId>
> <configuration>
> <locales>fr,en</locales>
> </configuration>
> </plugin>
>
> <plugin>
> <groupId>oqube.muse</groupId>
> <artifactId>muse-maven-plugin</artifactId>
> <version>1.0-SNAPSHOT</version>
> <executions>
> <execution>
> <id>tests</id>
> <goals>
> <goal>publish</goal>
> </goals>
> <configuration>
> <sourceOutput>target/generated-test-sources</sourceOutput>
> <testSource>true</testSource>
> <filterIn>.*Test.java</filterIn>
> <lenient>true</lenient>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
>
> <distributionManagement>
> <site>
> <id>oqube.com</id>
> <url>scp://www.oqube.com/var/www/</url>
> </site>
> </distributionManagement>
> <repositories>
> <repository>
> <id>oqube.com</id>
> <url>http://www.oqube.com/maven2/</url>
> </repository>
>
> </repositories>
>
> <dependencies>
> <dependency>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-site-plugin</artifactId>
> <version>2.0-beta-5</version>
> </dependency>
>
> <dependency>
> <groupId>org.apache.maven.doxia</groupId>
> <artifactId>doxia-site-renderer</artifactId>
> <version>1.0-alpha-8-muse</version>
> </dependency>
>
> </dependencies>
>
> <reporting>
> <excludeDefaults>true</excludeDefaults>
> </reporting>
>
> </project>
>
> Help appreciated...
> --
> OQube < software engineering \ génie logiciel >
> Arnaud Bailly, Dr.
> \web> http://www.oqube.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/maven-embedder-pb-tf3134570s177.html#a8701774
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]