Failure to do "mvn apigee-enterprise:deploy" on Windows: "Invalid resource url ref" error

Not applicable

This seems to only happen in Git Bash on Windows. My coworkers with Macs don't have the issue.

My error:

[ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.1:deploy (default-cli) on project reporting: MojoExecutionException: com.google.api.client.http.HttpResponseException: 400 Bad Request
[ERROR] {
[ERROR] "code" : "messaging.config.beans.InvalidResourceURLRef",
[ERROR] "message" : "Invalid resource url ref jsc://js_validateReportingWriteScope3.js in policy js_validateReportingWriteScope3 in cambiahealth-nonprod",
[ERROR] "contexts" : [ ],
[ERROR] "cause" : {
[ERROR] "code" : "messaging.config.beans.ResourceDoesNotExist",
[ERROR] "message" : "Resource with name js_validateReportingWriteScope3.js and type jsc does not exist",

Things I've tried:

  1. mvn clean
  2. mvn dependency:purge-local-repository
  3. IntelliJ invalidate caches and restart
  4. Deleting all the local files and cloning from the remote repo
  5. I tried renaming the file to a new name, in hopes it would pick up the new filename (hence why you see "3" in the filenames)
  6. Switching to a different WiFi network

The exact command that fails is:

mvn apigee-enterprise:deploy -P$environment -Dusername=$username -Dpassword=$password

The command that works (but we don't want to use, because it wipes the current deploy and replaces it, losing historical info):

mvn apigee-enterprise:deploy -P$environment -Dapigee.options=clean -Dusername=$username -Dpassword=$password

Any ideas? I'm stumped.

Solved Solved
0 2 429
1 ACCEPTED SOLUTION

HI @Aaron Shaver

Looks like the js files are not getting copied to target. You can force it by using the copy-resources via the plugin

<!-- copy the full apiproxy folder to target folder -->
<plugin>
	<artifactId>maven-resources-plugin</artifactId>
	<version>2.6</version>
	<executions>
		<execution>
			<id>copy-resources</id>
			<phase>package</phase>
			<goals>
				<goal>copy-resources</goal>
			</goals>
			<configuration>
				 <!--this is important -->
				<overwrite>true</overwrite>
				 <!--target -->
				<outputDirectory>${target.root.dir}/apiproxy</outputDirectory>
				<resources>
					<resource>
						 <!--source -->
						<directory>${project.root.dir}/apiproxy</directory>
					</resource>
				</resources>
			</configuration>
		</execution>
	</executions>
</plugin>

Let me know if that helps. If it did, please accept the answer so that others can use this as reference.

View solution in original post

2 REPLIES 2

HI @Aaron Shaver

Looks like the js files are not getting copied to target. You can force it by using the copy-resources via the plugin

<!-- copy the full apiproxy folder to target folder -->
<plugin>
	<artifactId>maven-resources-plugin</artifactId>
	<version>2.6</version>
	<executions>
		<execution>
			<id>copy-resources</id>
			<phase>package</phase>
			<goals>
				<goal>copy-resources</goal>
			</goals>
			<configuration>
				 <!--this is important -->
				<overwrite>true</overwrite>
				 <!--target -->
				<outputDirectory>${target.root.dir}/apiproxy</outputDirectory>
				<resources>
					<resource>
						 <!--source -->
						<directory>${project.root.dir}/apiproxy</directory>
					</resource>
				</resources>
			</configuration>
		</execution>
	</executions>
</plugin>

Let me know if that helps. If it did, please accept the answer so that others can use this as reference.

Note that while this works to solve the copying, it is breaking our inclusion of additional Apigee policies that come from a parent POM and a "common" proxy that's outside the current one. As such, this is only a partial solution. My ultimate solution will be to convert over to a Mac, because this issue is only happening on Windows computers.