jib: Exclude folders not working

Hi ,

Environment:

  • Jib version: 3.4.0
  • Build tool: Maven
  • *OS:

Description of the issue:

Extradirectory exclusion not working .

      <extraDirectories>
                        <!-- Copy only directories from the /path/to/your/source-directory into the /app directory in the container -->
                        <paths>
                            <path>
                                <from>/mycontent/init/</from>
                                <into>/app</into>
                                <excludes>
                                    <exclude>**/target/**/**</exclude> <!-- Exclude target directory and its contents -->
                                    <exclude>**/src/**/**</exclude> <!-- Exclude src directory and its contents -->
                                    <exclude>**/classpath/**</exclude> <!-- Exclude classpath directory and its contents -->
                                    <exclude>pom.xml</exclude> <!-- Exclude pom.xml file -->
                                    <!-- You can specify multiple exclude elements if needed -->
                                </excludes>
                            </path>
                            <path>
                                <!-- Source directory -->
                                <from>${project.basedir}</from>
                                <!-- Destination directory in the container -->
                                <into>/app</into>
                                <!-- Exclude specific directories -->
                                <excludes>
                                    <exclude>target/**</exclude> <!-- Exclude target directory and its contents -->
                                    <exclude>src/**</exclude> <!-- Exclude src directory and its contents -->
                                    <exclude>pom.xml</exclude> <!-- Exclude pom.xml file -->
                                    <!-- Add more excludes if needed -->
                                </excludes>
                            </path>
                        </paths>
                    </extraDirectories>

Expected behavior:

Container image expected to exclude target and src folders. But, they are appearing in the produced image.

jib-maven-plugin Configuration:

   <extraDirectories>
                        <!-- Copy only directories from the /path/to/your/source-directory into the /app directory in the container -->
                        <paths>
                            <path>
                                <from>/mycontent/init/</from>
                                <into>/app</into>
                                <excludes>
                                    <exclude>**/target/**/**</exclude> <!-- Exclude target directory and its contents -->
                                    <exclude>**/src/**/**</exclude> <!-- Exclude src directory and its contents -->
                                    <exclude>**/classpath/**</exclude> <!-- Exclude classpath directory and its contents -->
                                    <exclude>pom.xml</exclude> <!-- Exclude pom.xml file -->
                                    <!-- You can specify multiple exclude elements if needed -->
                                </excludes>
                            </path>
                            <path>
                                <!-- Source directory -->
                                <from>${project.basedir}</from>
                                <!-- Destination directory in the container -->
                                <into>/app</into>
                                <!-- Exclude specific directories -->
                                <excludes>
                                    <exclude>target/**</exclude> <!-- Exclude target directory and its contents -->
                                    <exclude>src/**</exclude> <!-- Exclude src directory and its contents -->
                                    <exclude>pom.xml</exclude> <!-- Exclude pom.xml file -->
                                    <!-- Add more excludes if needed -->
                                </excludes>
                            </path>
                        </paths>
                    </extraDirectories>

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Thanks you so much for helping me out in here. This solution worked !