79160514

Date: 2024-11-05 20:06:32
Score: 1.5
Natty:
Report link

I based my answer on @walyrious idea. I execute bash -c 'source run.sh; custom-script.sh' in maven-antrun-plugin so that custom-script.sh is in the same shell as the sourced run.sh. Though, I think this maven execution is much cleaner than his answer:

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <groupId>org.apache.maven.plugins</groupId>
    <executions>
        <execution>
            <id>source file</id>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
                <target>
                    <exec executable="bash">
                        <arg line="-c 'source run.sh; custom-script.sh'"/>
                    </exec>
                </target>
            </configuration>
        </execution>
    </executions>
</plugin>
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @walyrious
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Kyle Seaman