Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8127625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:35:49+00:00 2026-06-06T07:35:49+00:00

I need to start up a jetty with an external (possibly remote) .war file

  • 0

I need to start up a jetty with an external (possibly remote) .war file (App T) as web app resource from inside my test so that my system under test (App A) can connect to it to run calls against its REST interface.

I found a lot of tutorials about how to start a jetty for the war of the system under test (App A). I also found some about how to have maven start jetty for an external .war (App T) as part of the build cycle. However I can’t figure out if it’s possible to do the above.

Ideally I add the AppT project as maven dependency and access it via classpath.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:35:51+00:00Added an answer on June 6, 2026 at 7:35 am

    Well, I don’t know how you would go about doing it, if it was a remote war file (you’d probably need to download it first before the execution of the jetty plugin), but here’s how to do it, when you’ve already got it somewhere on your file system:

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${version.jetty}</version>
                <configuration>
    
                    <contextHandlers>
                        <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
                            <war>${project.build.directory}/webapps/foo-bar.war</war>
                            <contextPath>/foo</contextPath>
                        </contextHandler>
                    </contextHandlers>
    
                </configuration>
            </plugin>
    

    My advice is to add that war as a dependency with scope:provided.

    <dependencies>
    
        <!-- Webapps which will not be included in the final WAR artifact: -->
        <dependency>
            <groupId>com.foo.bar</groupId>
            <artifactId>foo-bar</artifactId>
            <version>${version.foo.bar}</version>
            <type>war</type>
            <scope>provided</scope>
        </dependency>
    
    </dependencies>
    

    In addition, you will most-likely need something like:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.3</version>
    
                <executions>
                    <execution>
                        <!-- Used to copy the foo bar war to the webapps folder -->
                        <id>copy-dependency-foo-bar</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
    
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.foo.bar</groupId>
                                    <artifactId>foo-bar</artifactId>
                                    <version>${version.foo.bar}</version>
                                    <type>war</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/webapps</outputDirectory>
                                    <destFileName>foo-bar.war</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    

    This last bit above will make sure that the resolved artifact is copied over to your target directory’s webapps sub-folder before the jetty plugin has attempted to load it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to start an external process from my web application. This means using
I need to start a copy of a Rails app from within Java. I
I want to (need to) start a sub-process from a perl script that checks
When you deploy a web app (servlets) with embedded jetty, do you still need
I need to start a jar file with a *.bat file so that as
I need to start a Visual Basic script file by using WMI in a
I need to start a Unix process by calling a PHP-page through the web.
I need to start NSTimer by 0:0:0 that I am doing and I have
I need to start a project that will be json-API-centric, which means that most
I need to start H2 database in server mode from my application. Having tried

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.