'Maven-exec-plugin is not working with Python script

I'm on Ubuntu 20.04, trying to invoke python script with maven-exec-plugin.

Below is my maven-exec-plugin code.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>3.0.0</version>
   <executions>
       <execution>
           <id>python-test</id>
           <phase>compile</phase>
           <goals>
               <goal>exec</goal>
           </goals>
       </execution>
   </executions>
   <configuration>
       <executable>python3</executable>
       <workingDirectory>${project.build.directory}/python-scripts/</workingDirectory>
       <arguments>
           <argument>tear_down.py</argument>
       </arguments>
   </configuration>
</plugin> 

I get following output in console when I execute mvn compile. (Python script is not executed.)

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------------< automation:psh >---------------------------
[INFO] Building psh 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ psh ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/shraddha/Documents/Automation/psh-automation/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ psh ---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.423 s
[INFO] Finished at: 2022-04-15T15:04:57+05:30
[INFO] ------------------------------------------------------------------------

Can someone please help guide me? Thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source