boson-project / buildpacks

Boson Project function buildpacks
Apache License 2.0
5 stars 11 forks source link

Failed to build SpringCloudEventsApplication #64

Open danieloh30 opened 3 years ago

danieloh30 commented 3 years ago

Once SpringCloudEventsApplication is created via kn func create -l springboot -t events, this app can't be built with the following errors:

The template doesn't seem to be generated properly. For example, there is no definition about "HTTP_ATTR_PREFIX" in code.

ERROR] /workspace/src/main/java/functions/SpringCloudEventsApplication.java:[15,53] cannot find symbol [ERROR] symbol: class CloudEventAttributesP[builder] rovider [ERROR] location: package org.springframework.cloud.function.cloudeve[builder] nt [ERROR] /workspace/src/main/java/functions/SpringCloudEventsApplication.java:[33,7] [builder] cannot find symbol [ERROR] symbol: class CloudEventAttributesProvider [ERROR] location: [builder] class functions.SpringCloudEventsApplication [ERROR] /workspace/src/main/java/functions/SpringCloudEventsApplication.java[builder] :[59,10] cannot find symbol [ERROR] symbol: class CloudEventAttributesProvider [ERROR[builder] ] location: class functions.SpringCloudEventsApplication [ERROR] /workspace/src/main/java/functions/SpringCloudEventsApplication.java:[3,1] cannot find symbol [ERROR] symbol: static [builder] HTTP_ATTR_PREFIX [ERROR] location: class org.springframework.cloud.function.cloud[builder] event.CloudEventMessageUtils [ERROR] /workspace/src/main/j[builder] ava/functions/SpringCloudEventsApplication.java:[39,11] cannot find symbol [ERROR] symbol: variable HTTP_ATTR_PREFIX [ERROR] location: class functions.Spring[builder] CloudEventsApplication [ERROR] /workspace/src/main/java/functions/SpringCloudEventsApplication.java:[41,32] cannot find symbol [ERROR] symbol:[builder] variable HTTP_ATTR_PREFIX [ERROR] [builder] location: class functions.SpringCloudEventsApplication [ERROR] /workspace/src/main/java/functions/SpringCloudEventsApplication.java[builder] :[43,32] cannot find symbol [ERROR] symbol: variable HTTP_ATTR_PREFIX [ERROR] location: class functions.SpringCloudEventsApplication [ERROR] /[builder] workspace/src/main/java/functions/SpringCloudEventsApplication.java:[45,32] cannot find symbol [ERROR] symbol: variable HTTP_ATTR_PREFIX [ERROR] location: class functions.S[builder] pringCloudEventsApplication [ERROR] /works[builder] pace/src/main/java/functions/SpringCloudEventsApplication.java:[51,47] cannot find symbol [ERROR] symbol: variable HTT[builder] P_ATTR_PREFIX [ERROR] location: class fu[builder] nctions.SpringCloudEventsApplication [ERROR] -> [Help 1] [ERROR] [builder] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [builder] [ERROR] Re-run Maven using the -X switch to enable ful[builder] l debug logging. [ERROR] [ERROR] For more info[builder] rmation about the errors and possible solutions, please read the following articles: [builder] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN[builder] /MojoFailureException [builder] ERROR: failed to build: exit status 1

lance commented 3 years ago

@danieloh30 can this be closed now with https://github.com/boson-project/func/pull/265 having landed?

danieloh30 commented 3 years ago

@lance I just recreated a new spring boot project via kn func create spring-func-events -l springboot -t events but I still have the same error.

lance commented 3 years ago

@danieloh30 sorry! I should have been more explicit. Did you use the latest build from that PR? You can download it here https://github.com/boson-project/func/actions/runs/612739644

danieloh30 commented 3 years ago

@lance I think I have the latest. The link shows func tool but I'm most likely using 'kn func'

Here is what I'm using:

kn version Version: v0.19.1 Build Date: 2021-01-27 23:01:29 Git Revision: f513c321 Supported APIs:

lance commented 3 years ago

@danieloh30 kn func is the standard kn CLI augmented with the func binary as a plugin. The version you have does not have the most recent changes. To test those, you'd download the func binary and just invoke it as func create... etc. But no worries. It's easy enough for me to do that and test on my computer.

danieloh30 commented 3 years ago

Still a bit confused. What is our position to create, build, and deploy functions? kn or func?

When will you merge this fix to kn cli?

Also, I see this version. Is this correct?

./func_darwin_amd64 version v0.0.0

lance commented 3 years ago

Sorry for the confusion, @danieloh30. You can think of func as the upstream for kn func. When we ship kn in OpenShift Serverless, func is included in the kn binary as a plugin. You can see where we are doing that here: https://github.com/boson-project/func/blob/8143ea1056626b238c40010fb0ede3bdc5fb5065/plugin/plugin.go#L8. So, when we are testing out pre-release versions, we typically just use the func CLI rather than going to the trouble of building kn with the func plugin. When you are using the func CLI, it's no different than when using kn func. That's why sometimes you see commands written either way.

We will ship the next kn build in 1.14. In the meantime, if you want to use the latest and greatest, you can just download func and use it.

The version problem was a known issue that should be resolved now. https://github.com/boson-project/func/issues/204

danieloh30 commented 3 years ago

Good to know. Here are further questions:

1) As you said, func allows me to deploy spring boot with cloudevent to openshift so when I can do the same thing in kn func cli? 2) I downloaded func binary last week but it still shows v0.0.0. According to boson-project/func#204, should it already be fixed it?

lance commented 3 years ago

As you said, func allows me to deploy spring boot with cloudevent to openshift so when I can do the same thing in kn func cli?

The next Serverless release (1.14) should have this. It will be available in the next couple of weeks.

I downloaded func binary last week but it still shows v0.0.0. According to boson-project/func#204, should it already be fixed it?

Hmm - I will follow up on this in the func repo.