Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit java template to allow resources #72

Open
ivanayov opened this issue Sep 21, 2018 · 5 comments · May be fixed by #86
Open

Edit java template to allow resources #72

ivanayov opened this issue Sep 21, 2018 · 5 comments · May be fixed by #86
Assignees

Comments

@ivanayov
Copy link
Contributor

Raised on slack.

Resources, located in funcName/src/main/resources, are not available in the image after build.

Expected Behaviour

All resources should be available in the image.

Possible Solution

Follow Gradle documentation (possibly use SourceSet) and edit build.gradle

Steps to Reproduce (for bugs)

  1. faas-cli new funcName --lang java8
  2. Add resources to /src/main/resources
  3. Build
  4. Check that resources are not available
@ivanayov
Copy link
Contributor Author

I'm on it

@ivanayov
Copy link
Contributor Author

This does the work:

sourceSets {
    main {
        resources {
            srcDirs "src/main/resources"
        }
    }

The issue is because model is what's compiled in function's build.gradle config and it takes src/main/resources from model/ template dir.

@ivanayov
Copy link
Contributor Author

I'm going to update tomorrow

@ivanayov
Copy link
Contributor Author

ivanayov commented Oct 2, 2018

The problem occurs while entrypoint distribution is created. The original function.jar contains the resources, but the copied one does not.
The gradle build logs say nothing about jar clean-up, nor it's configured within the template:

16:01:58.896 [DEBUG] [org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter] Ensuring parent directory exists for property archivePath (OUTPUT) at /home/app/function/bui
ld/libs/function-1.0.jar
16:01:58.896 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':function:jar'.
16:01:58.897 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute copy for :function:jar' started
16:01:58.900 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute copy for :function:jar'
16:01:58.900 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute copy for :function:jar' completed
16:01:58.900 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Snapshotting property archivePath (OUTPUT) for task ':function:jar'
16:01:58.901 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
16:01:58.901 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':function:jar'
16:01:58.901 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Task :function:jar'
16:01:58.901 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Task :function:jar' completed
16:01:58.901 [INFO] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] :function:jar (Thread[Task worker for ':',5,main]) completed. Took 0.009 secs.

(1) Bad but working solution: replace function.jar within entrypoint distribution after gradle build in Dockerfile

(2) Better approach: Fix within gradle configuration.

I didn't find a working solution for (2) yet. Still on it today.

@ivanayov ivanayov linked a pull request Oct 2, 2018 that will close this issue
11 tasks
@ivanayov
Copy link
Contributor Author

ivanayov commented Oct 2, 2018

Have the fix in #86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant