Home > Software design >  How to create jar file without java classes but with a folder using maven
How to create jar file without java classes but with a folder using maven

Time:07-26

I created jar file from some reporting designer tool: enter image description here And now I want to create same jar file but with maven. So I have the fonts and that properties file and created new maven module and I am wondering what plugin should be used to achieve exactly the structure as in the picture attached. Let's say that I have those fonts in /src/main/resources folder together with jasperreports_extension.properties in my new maven module and in second option I have those fonts in some external folder like /home/user/fonts also together with jasperreports_extension.properties

Currently I am using those fonts to embedd to them to jasper reports and it can be done if this jar is on classpath of running application.

It is working with below approach, but for audit reasons I need to remove all system-scope dependencies.

<dependency>
            <groupId>my.group.id</groupId>
            <artifactId>my-fonts</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/resources/reps/fonts.jar</systemPath>
        </dependency>

Regards

CodePudding user response:

src/main/resources are resources to be put on the classpath which are copied to the jar file "as-is" (except you may ask for the files to be filtered, which means "expand variables, please").

So if you put your files in src/main/resources/fonts you should get what I think you ask for, as part as a normal compilation even if you don't have any Java files in the project.

  • Related