Skip to content
Advertisement

How to include a file from a directory above in Maven src.xml?

I want to include the .gitignore file in my Maven project when it is getting packaged. (My university wants the file so they can see that I used it the right way)

But the .gitignore is on the workspace directory.

I know that I can add files from directorys below with this in my src.xml

<fileSet>
    <directory>src/test/resources</directory>
    <includes>
        <include>checkstyle_swt1.xml</include>
    </includes>
</fileSet>

But as the .gitignore isnt below src/ I dont know how to include it.

So far I have tried following:

<fileSet>
    <directory>C:/Users/Samue/OneDrive/SWTest</directory>
    <includes>
        <include>.gitignore</include>
    </includes>
</fileSet>

This didnt work unfortnuately. Any other ideas?

Advertisement

Answer

Simply use ../../ and you also need to set default exludes to false

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement