-1

My java project structure is as follows

├── code
│   ├── java
│   │   └── PROJECT
│   │       ├── pom.xml
│   │       └── src

After deployment the directory structure is coming as

../PROJECT/target/xyz.jar

Now if I want to create the jar file as without "target" directory, how to achieve it. Example

../PROJECT/xyz.jar

My Maven assembly file used is

   <fileSet>
        <directory>code/java/</directory>
        <outputDirectory>jlib/</outputDirectory>
        <filtering>true</filtering>
        <includes>
            <include>**/*.jar</include>
        </includes>
    </fileSet>

Can some one please help to achieve the above ?

Dileep Dominic
  • 499
  • 11
  • 23
  • Change the output directory in the `configuration` of the `maven-assembly-plugin` in your `pom.xml`. – dan1st Oct 01 '19 at 05:13
  • Changing the standard directories for Maven should only be done if absolutely necessary. Furthermore, writing outside of `target` should be avoided. Are you really sure you need this? – J Fabian Meier Oct 01 '19 at 07:41

1 Answers1

0

Can you give us a little bit more information about your build and deployment process?

  • Is there a reason why you don't want it in the target directory (e.g. you build on your target server)?

You taged also jenkins. You could do a simple move statement as shell after building your application to move your jar file(s) into an other directory:

mv jlib/PROJECT/target/xyz.jar jlib/PROJECT/xyz.jar
RNoB
  • 323
  • 2
  • 9
  • This is not really an answer, but a comment. If you do not have enough reputation to write a comment, please don't write an answer instead. – J Fabian Meier Oct 01 '19 at 09:05
  • In my opinion my second point is a answer. It is maybe not the perfekt way to do it, but it should work. Because of that I had the question at the beginning. If there will be an answer I can deliver maybe a better answer. – RNoB Oct 01 '19 at 11:11