2017-04-21 14 views
1

내가 ant.signjar를 사용하여 JAR 파일에 서명하는 것을 시도하고있다 Gradle을에 종속성을 포함 할 때 항아리 작동하지, 그것을 잘 작동하고있는 을 종속성을 포함,하지만 난 jar 파일에 대한 의존성을 포함 때 그것은 나를 jarsigner를 반환 말하는 된 오차가 발생하지 않습니다 : 1jarsigner의 Ant.signjar 의존하지 않고 jar 파일에 대한 작업을하지만, 스크립트

Gradle을 스크립트를

(종속성이없는 항아리에 대한)
apply plugin: 'application' 

mainClassName = 'com.test.webdeployment.ClientApplication' 

compileJava { 
    sourceCompatibility = '1.8' 
    targetCompatibility = '1.8' 
} 

dependencies { 
    compile project(':common') 
    compile project(':dolphin-platform-client-javafx') 
} 

jar { 
    archiveName = 'FXClient.jar' 
} 

jar.doLast { 
    def libFiles = files { file('build/libs').listFiles() } 
    libFiles.each { 
     ant.signjar(
       alias: "test", 
       jar: it, 
       keystore: "keystore/test.keystore", 
       storepass: "123456", 
       keypass: "123456", 
       destDir: 'fxclient', 
       preservelastmodified: 'true' 
     ) 
    } 
} 

build.dependsOn jar 

apply plugin: 'application' 

mainClassName = 'com.test.webdeployment.ClientApplication' 

compileJava { 
    sourceCompatibility = '1.8' 
    targetCompatibility = '1.8' 
} 

dependencies { 
    compile project(':common') 
    compile project(':dolphin-platform-client-javafx') 
} 

jar { 
    archiveName = 'FXClient.jar' 
    from { 
     configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } 
    } 
} 

jar.doLast { 
    def libFiles = files { file('build/libs').listFiles() } 
    libFiles.each { 
     ant.signjar(
       alias: "test", 
       jar: it, 
       keystore: "keystore/test.keystore", 
       storepass: "123456", 
       keypass: "123456", 
       destDir: 'fxclient', 
       preservelastmodified: 'true' 
     ) 
    } 
} 

build.dependsOn jar 

스택 추적 (종속 관계 항아리에 대한)

Gradle을 스크립트

Exception is: 
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':client:jar'. 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84) 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55) 
     at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62) 
     at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) 
     at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88) 
     at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46) 
     at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51) 
     at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) 
     at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 
     at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) 
     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236) 
     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228) 
     at org.gradle.internal.Transformers$4.transform(Transformers.java:169) 
     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) 
     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61) 
     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228) 
     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215) 
     at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77) 
     at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58) 
     at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32) 
     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113) 
     at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) 
     at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) 
     at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) 
     at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) 
     at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) 
     at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) 
     at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) 
     at org.gradle.initialization.DefaultGradleLauncher$RunTasksAction.execute(DefaultGradleLauncher.java:256) 
     at org.gradle.initialization.DefaultGradleLauncher$RunTasksAction.execute(DefaultGradleLauncher.java:253) 
     at org.gradle.internal.Transformers$4.transform(Transformers.java:169) 
     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) 
     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56) 
     at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:175) 
     at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119) 
     at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102) 
     at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71) 
     at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) 
     at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 
     at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41) 
     at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) 
     at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75) 
     at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49) 
     at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:49) 
     at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:31) 
     at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67) 
     at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
     at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47) 
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
     at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) 
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
     at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) 
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
     at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) 
     at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) 
     at org.gradle.util.Swapper.swap(Swapper.java:38) 
     at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) 
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
     at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) 
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
     at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) 
     at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
     at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72) 
     at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
     at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) 
     at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297) 
     at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) 
     at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46) 
Caused by: : jarsigner returned: 1 
     at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:644) 
     at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670) 
     at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496) 
     at org.apache.tools.ant.taskdefs.SignJar.signOneJar(SignJar.java:534) 
     at org.apache.tools.ant.taskdefs.SignJar.execute(SignJar.java:449) 
     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) 
     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
     at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:78) 
     at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:103) 
     at client_65u3l6p4lilyt8z1uffayl9g$_run_closure4$_closure8.doCall(/Users/ganeshdeshvini/work/canoo_projects/dolphin-platform-examples/platform-examples/web-deployment-example/client/client.gradle:32) 
     at client_65u3l6p4lilyt8z1uffayl9g$_run_closure4.doCall(/Users/ganeshdeshvini/work/canoo_projects/dolphin-platform-examples/platform-examples/web-deployment-example/client/client.gradle:31) 
     at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:596) 
     at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:577) 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95) 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76) 
     ... 70 more 

나 종속성이있는 JAR 파일에 서명을위한 jarsigner의 작업을 얻는 방법을 알려주세요 포함 된, 내가 gradle 스크립트를 처음 사용하는 경우

답변

0

마지막으로 알아 냈습니다. 전자 솔루션 매니페스트 코드를 추가

최종 Gradle을 스크립트

apply plugin: 'application' 

mainClassName = 'com.test.webdeployment.ClientApplication' 

compileJava { 
    sourceCompatibility = '1.8' 
    targetCompatibility = '1.8' 
} 

dependencies { 
    compile project(':common') 
    compile project(':dolphin-platform-client-javafx') 
} 

jar { 
    archiveName = 'fxclient.jar' 
    from { 
     configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } 
    } 
} 

jar.doLast { 
    def libFiles = files { file('build/libs').listFiles() } 
    libFiles.each { 

     ant.jar(destfile: it, update: true) { 
      delegate.manifest { 
       attribute(name: 'permissions', value: 'all-permissions') 
       attribute(name: 'codebase', value: '*') 
      } 
     } 

     ant.signjar(
       alias: "test", 
       jar: it, 
       keystore: "keystore/test.keystore", 
       storepass: "123456", 
       keypass: "123456", 
       destDir: 'fxclient', 
       preservelastmodified: 'true' 
     ) 
    } 
} 

build.dependsOn jar