You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Christian Plessl <ch...@plesslweb.ch> on 2007/02/05 12:25:54 UTC

Installing application in a directory for test purposes

Dear Maven Users

I have recently converted my java command-line application to Maven. While building an packaging the application generally works well, I still cannot figure out a good workflow for deploying the application to a local directory for testing purposes.

I would like to use the following directory layout in the target (i.e. installation) directory of my application:

app_directory
 + bin/
     myapp.sh  (application wrapper, sets up the environment etc.)
 + lib/ (directory with all libraries used by myapp)
     lib1.jar
     lib2.jar
 + myapp.jar (my application: either as jar file, or in directories org/myname/myapp/..)
 + moreresources/

With this directory layout, I can run my application with commands like:
 ./bin/myapp.sh -arg1 value1 -arg2 value2

Unfortunately, I have not discovered a good way to install the application using this directory layout. My current solution is to use the assembly plugin and execute the assembly:directory target. I'm using the following configuration for the assembly plugin.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-assembly-plugin</artifactId>
 <configuration>
   <descriptorRefs>
     <descriptorRef>jar-with-dependencies</descriptorRef>
   </descriptorRefs>
 </configuration>
</plugin>

When executing the assembly:directory plugin, the application gets installed in directory target/myapp-1.0-SNAPSHOT-jar-with-dependencies, but all jar files myapp depends on are unpacked. Since my  application depends on many, large jar files this step is simply too time-consuming for frequent rebuilds. 

In particular, the assembly plugin seems incapable of dealing with incremental changes and hence the jar files are unpacked every time assembly:directory is executed.


I would prefer that the build process figures out which jar files to include in the lib directory from the project dependencies in  pom.xml, but that the jar files are not unpacked.

Is there a better way, to achieve the installation of the application in a directory?

Best regards,
 Christian


-- 
Christian Plessl <ch...@plesslweb.ch> http://plesslweb.ch


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


Re: Installing application in a directory for test purposes

Posted by Christian Plessl <ch...@plesslweb.ch>.
Hi Marco

> any particular reason why you can't run test from your src\test directory,
> since all your mainapp classes will be in the classpath ?

The expected results of these ad-hoc tests are not formally defined. Since the application is a command-line application, I would like to be able to test the application from the command-line, instead of writing a JUnit test living in src/test. Being able to quickly run the application from the command-line helps me to rapidly try out different parameters.  

But you are right, I could also wrap all my command-line test in a JUnit testcase and call my main class appropriately.

> do you need to have your app installed for testing purposes?

As mentioned above, this would facilitate ad-hoc testing.

Best regards,
 Christian

-- 
Christian Plessl <ch...@plesslweb.ch> http://plesslweb.ch


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


Re: Installing application in a directory for test purposes

Posted by Marco Mistroni <mm...@gmail.com>.
Hi,
 any particular reason why you can't run test from your src\test directory,
since all your mainapp classes will be in the classpath ?

do you need to have your app installed for testing purposes?

hth
 marco

On 2/5/07, Christian Plessl <ch...@plesslweb.ch> wrote:
>
> Dear Maven Users
>
> I have recently converted my java command-line application to Maven. While
> building an packaging the application generally works well, I still cannot
> figure out a good workflow for deploying the application to a local
> directory for testing purposes.
>
> I would like to use the following directory layout in the target (i.e.
> installation) directory of my application:
>
> app_directory
> + bin/
>      myapp.sh  (application wrapper, sets up the environment etc.)
> + lib/ (directory with all libraries used by myapp)
>      lib1.jar
>      lib2.jar
> + myapp.jar (my application: either as jar file, or in directories
> org/myname/myapp/..)
> + moreresources/
>
> With this directory layout, I can run my application with commands like:
> ./bin/myapp.sh -arg1 value1 -arg2 value2
>
> Unfortunately, I have not discovered a good way to install the application
> using this directory layout. My current solution is to use the assembly
> plugin and execute the assembly:directory target. I'm using the following
> configuration for the assembly plugin.
>
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-assembly-plugin</artifactId>
> <configuration>
>    <descriptorRefs>
>      <descriptorRef>jar-with-dependencies</descriptorRef>
>    </descriptorRefs>
> </configuration>
> </plugin>
>
> When executing the assembly:directory plugin, the application gets
> installed in directory target/myapp-1.0-SNAPSHOT-jar-with-dependencies,
> but all jar files myapp depends on are unpacked. Since my  application
> depends on many, large jar files this step is simply too time-consuming for
> frequent rebuilds.
>
> In particular, the assembly plugin seems incapable of dealing with
> incremental changes and hence the jar files are unpacked every time
> assembly:directory is executed.
>
>
> I would prefer that the build process figures out which jar files to
> include in the lib directory from the project dependencies in  pom.xml,
> but that the jar files are not unpacked.
>
> Is there a better way, to achieve the installation of the application in a
> directory?
>
> Best regards,
> Christian
>
>
> --
> Christian Plessl <ch...@plesslweb.ch> http://plesslweb.ch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>