File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
graalpy-maven-plugin/src/main/java/org/graalvm/python/maven/plugin Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 4040 */
4141package org .graalvm .python .maven .plugin ;
4242
43+ import java .nio .file .Files ;
4344import org .apache .maven .plugin .MojoExecutionException ;
4445import org .apache .maven .plugins .annotations .LifecyclePhase ;
4546import org .apache .maven .plugins .annotations .Mojo ;
@@ -100,7 +101,16 @@ private void manageVenv() throws MojoExecutionException {
100101 MavenDelegateLog log = new MavenDelegateLog (getLog ());
101102 Path lockFile = getLockFile ();
102103 Path reqFile = resolveReqFile ();
103- if ((packages == null || packages .isEmpty ()) && reqFile == null ) {
104+
105+ boolean emptyPackages = packages == null || packages .isEmpty ();
106+ boolean hasReqFile = reqFile != null && Files .exists (reqFile );
107+ boolean hasLockFile = lockFile != null && Files .exists (lockFile );
108+
109+ if (emptyPackages && !hasReqFile ) {
110+ if (hasLockFile ) {
111+ throw new MojoExecutionException (
112+ "Lock file is present, but no Python packages or requirements.txt are configured." );
113+ }
104114 return ;
105115 }
106116 try {
You can’t perform that action at this time.
0 commit comments