You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jozsef Zsido <zs...@gmail.com> on 2009/04/26 12:35:37 UTC

dependency to run jetty on a dependent project

Hi,



I have the following setup:

A super pom project which enumerates 2 modules: a web service war project
and a web service client project.

The web service client calls the wsimport goal in order to generate the
client artifacts but that fails if I don’t run the other project with mvn
jetty:run.

In order to run the web service client tests also requires that the jetty to
run.



How could I do this automatically?



Thanks,

Jozsef

Re: dependency to run jetty on a dependent project

Posted by Grant Rettke <gr...@acm.org>.
On Wed, Apr 29, 2009 at 6:19 PM, ZsJoska <zs...@gmail.com> wrote:
> Could not convince jetty to start in the generate-sources phase...

That passes my current bounds of knowledge :).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency to run jetty on a dependent project

Posted by ZsJoska <zs...@gmail.com>.

Hi,
I was able to integrate in the WS client the jetty plugin in war mode and
setting explicitly the path to the other module's war package but now the
problem the build phase.
Could not convince jetty to start in the generate-sources phase...

Regards,
Jozsef


ZsJoska wrote:
> 
> Hi, thanks for the tipp;
> I do have a parent project but the jetty:run command does not work on it
> :-((
> I tried to search for a solution for this but with no result.
> Do you have a sample at a handy place for a such dependency ?
> 
> Thanks,
> Jozsef
> 
> 
> Grant Rettke wrote:
>> 
>> On Tue, Apr 28, 2009 at 8:52 AM, ZsJoska <zs...@gmail.com> wrote:
>>> How could I make the wsimport goal from myProject-wsclient to depend
>>> from
>>> the jetty:run goal in the myProject-ws module.
>> 
>> Why not create a POM that references these two projects a sub-modules.
>> 
>> You can initiate the goals in the order that you desire.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/dependency-to-run-jetty-on-a-dependent-project-tp23252831p23302613.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency to run jetty on a dependent project

Posted by ZsJoska <zs...@gmail.com>.
Hi, thanks for the tipp;
I do have a parent project but the jetty:run command does not work on it
:-((
I tried to search for a solution for this but with no result.
Do you have a sample at a handy place for a such dependency ?

Thanks,
Jozsef


Grant Rettke wrote:
> 
> On Tue, Apr 28, 2009 at 8:52 AM, ZsJoska <zs...@gmail.com> wrote:
>> How could I make the wsimport goal from myProject-wsclient to depend from
>> the jetty:run goal in the myProject-ws module.
> 
> Why not create a POM that references these two projects a sub-modules.
> 
> You can initiate the goals in the order that you desire.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/dependency-to-run-jetty-on-a-dependent-project-tp23252831p23302400.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency to run jetty on a dependent project

Posted by Grant Rettke <gr...@acm.org>.
On Tue, Apr 28, 2009 at 8:52 AM, ZsJoska <zs...@gmail.com> wrote:
> How could I make the wsimport goal from myProject-wsclient to depend from
> the jetty:run goal in the myProject-ws module.

Why not create a POM that references these two projects a sub-modules.

You can initiate the goals in the order that you desire.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency to run jetty on a dependent project

Posted by ZsJoska <zs...@gmail.com>.

Thanks,

basically this is the web service client's pom.xml. does not define any type
of direct dependency to the myProject-ws project since the dependency is
through the web service

How could I make the wsimport goal from myProject-wsclient to depend from
the jetty:run goal in the myProject-ws module.


Thanks,
Jozsef

<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>myProject</groupId>
	<artifactId>myProject-wsclient</artifactId>
	<packaging>jar</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>myProject-wsclient</name>
	<url>http://maven.apache.org</url>
	<parent>
		<groupId>myProject</groupId>
		<artifactId>myProject</artifactId>
		<version>1.0-SNAPSHOT</version>
	</parent>
...
	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>jaxws-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>wsimport</goal>
						</goals>
						<configuration>
							<wsdlUrls>
								<wsdlUrl> http://localhost:8080/myProject-ws/ws/AuthService?wsdl 
								</wsdlUrl>
								<wsdlUrl> http://localhost:8080/myProject-ws/ws/UserService?wsdl 
								</wsdlUrl>
							</wsdlUrls>
							<packageName>org.myproject
							</packageName>
							<verbose>true</verbose>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>


Grant Rettke wrote:
> 
> On Mon, Apr 27, 2009 at 1:48 PM, ZsJoska <zs...@gmail.com> wrote:
>> Thanks for your answer but is that possible to attach to the
>> code-generation
>> (i think is more suitable) phase the jetty:run goal from/for another
>> pom.xml?
> 
> You can attach that goal to any phase you wish.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/dependency-to-run-jetty-on-a-dependent-project-tp23252831p23277586.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency to run jetty on a dependent project

Posted by Grant Rettke <gr...@acm.org>.
On Mon, Apr 27, 2009 at 1:48 PM, ZsJoska <zs...@gmail.com> wrote:
> Thanks for your answer but is that possible to attach to the code-generation
> (i think is more suitable) phase the jetty:run goal from/for another
> pom.xml?

You can attach that goal to any phase you wish.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency to run jetty on a dependent project

Posted by ZsJoska <zs...@gmail.com>.
Hi,

Thanks for your answer but is that possible to attach to the code-generation
(i think is more suitable) phase the jetty:run goal from/for another
pom.xml?


Grant Rettke wrote:
> 
>> How could I do this automatically?
> 
> Would attaching the jetty:run goal to the pre-test phase solve your
> problem?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/dependency-to-run-jetty-on-a-dependent-project-tp23252831p23262609.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency to run jetty on a dependent project

Posted by Grant Rettke <gr...@acm.org>.
> How could I do this automatically?

Would attaching the jetty:run goal to the pre-test phase solve your problem?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency to run jetty on a dependent project

Posted by ZsJoska <zs...@gmail.com>.
With the help of Darren we solved the above problem quite elegantly:
To the generate-sources phase of the web service client we could bind the
following executions:
- a dependency-plugin call to copy to the target directory the war file
produced by the web service project
- jetty:start goal to start the jetty instance with the copied war file
- a wsimport goal to generate the artifacts
They are executed in the enumerated order so it is just fine. somwhere in
the post-integration-test we can close the jetty instance

The relevant part looks like:
	<build>
		<plugins>
			<plugin>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>prepare-myProject-ws</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>copy</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>${project.groupId}</groupId>
									<artifactId>myProject-ws</artifactId>
									<version>${project.version}</version>
									<type>war</type>
									<outputDirectory>${project.build.directory}</outputDirectory>
									<destFileName>myProject-ws.war</destFileName>
								</artifactItem>
							</artifactItems>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
				<version>6.1.16</version>
				<configuration>
					<scanIntervalSeconds>0</scanIntervalSeconds>
					<daemon>true</daemon>
					<stopKey>foo</stopKey>
					<stopPort>9999</stopPort>
					<webApp>${project.build.directory}/myProject-ws.war</webApp>
					<contextPath>/myProject-ws</contextPath>
				</configuration>
				<executions>
					<execution>
						<id>start-jetty</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>deploy-war</goal>
						</goals>
					</execution>
					<execution>
						<id>stop-jetty</id>
						<phase>post-integration-test</phase>
						<goals>
							<goal>stop</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>jaxws-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>wsimport</goal>
						</goals>
						<configuration>
							<wsdlUrls>
							
<wsdlUrl>http://localhost:8080/myProject-ws/ws/AuthService?wsdl</wsdlUrl>
							
<wsdlUrl>http://localhost:8080/myProject-ws/ws/UserService?wsdl</wsdlUrl>
							</wsdlUrls>
							<packageName>org.myProject</packageName>
							<verbose>true</verbose>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

-- 
View this message in context: http://www.nabble.com/dependency-to-run-jetty-on-a-dependent-project-tp23252831p25215374.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org