SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
gradle




                                     Thor Åge Eldby



Monday, November 21, 2011                             1
Thor Åge Eldby


                 @thoraageeldby


                            Arktekk




                                      2
Monday, November 21, 2011                 2

2.5 år in Arktekk
16 år in system development
Build Systems

                   make


                                                sbt
                                           3
Monday, November 21, 2011                              3

Make, batch-files (COS,Steinar Haugen,Kenneth Stigen)
ant -> can compile java
maven -> conventions, dependencies
sbt and now gradle
What: Repeatable



                            ear     ear       ear   ear




                                          4
Monday, November 21, 2011                                 4

Independent from host, platform, time
All information in build scripts
•How
•What
•Externals
-Ant
What: Flexible




                                  5
Monday, November 21, 2011                    5

Possible to build
Simple
-Maven, Ant
What: Readable




                                  6
Monday, November 21, 2011                    6

Not a black box
Diffable
GUI is not
What: Conventions




                                    7
Monday, November 21, 2011                       7

Recognisable
Structures
Commands
-Ant
8
Monday, November 21, 2011                          8

Repeatable
Flexible - Groovy (and ant) building DSL
Readable
Conventions - Follows maven structure partly

Systemised, programmable ant
Simple Example
                      apply plugin: 'java'

                      repositories {
                        mavenCentral()
                      }

                      dependencies {
                        compile 'com.google.guava:guava:r08'
                      }



                                         9
Monday, November 21, 2011                                      9

Needed to compile java code into jar
Build DSL
Script blocks (many)
Plugin
                      apply plugin: 'java'

                      repositories {
                        mavenCentral()
                      }

                      dependencies {
                        compile 'com.google.guava:guava:r08'
                      }



                                         10
Monday, November 21, 2011                                      10

Interpreted script
Dependencies
                      apply plugin: 'java'

                      repositories {
                        mavenCentral()
                      }

                      dependencies {
                        compile 'com.google.guava:guava:r08'
                      }



                                         11
Monday, November 21, 2011                                      11

Configuration like scope in maven
... and classpath in ant
Dependencies
                      apply plugin: 'java'

              repositories {
          dependencies {
                mavenCentral()
            compile project(':common')
              }
          }
              dependencies {
                compile 'com.google.guava:guava:r08'
              }



                                        11
Monday, November 21, 2011                              11

Configuration like scope in maven
... and classpath in ant
Dependencies
                      apply plugin: 'java'

              repositories {
          dependencies {
          dependencies {
                mavenCentral()
            testCompile group: 'junit', name: 'junit',
            compile project(':common')
              }
              version: '4.+'
          }
          }   dependencies {
                compile 'com.google.guava:guava:r08'
              }



                                        11
Monday, November 21, 2011                                11

Configuration like scope in maven
... and classpath in ant
Dependencies
                      apply plugin: 'java'

          dependencies {
              repositories {
          dependencies {
          dependencies {
            compile('org.hibernate:hibernate:3.0.5') {
                mavenCentral()
            testCompile group: 'junit', name: 'junit',
            compile project(':common')
              transitive = false
              }
              version: '4.+'
          } }
          }   dependencies {
          }
                compile 'com.google.guava:guava:r08'
              }



                                        11
Monday, November 21, 2011                                11

Configuration like scope in maven
... and classpath in ant
Dependencies
                      apply plugin: 'java'

          dependencies {
              repositories {
          dependencies {
          dependencies {
            compile('org.hibernate:hibernate:3.0.5') {
            runtime files('libs/a.jar', 'libs/b.jar')
                mavenCentral()
            testCompile group: 'junit', name: 'junit',
            runtime fileTree(dir: 'libs',
            compile project(':common')
              transitive = false
              }
              version: '4.+'
          } }                include: '*.jar')
          }   dependencies {
          }
                compile 'com.google.guava:guava:r08'
              }



                                        11
Monday, November 21, 2011                                11

Configuration like scope in maven
... and classpath in ant
Dependencies
                      apply plugin: 'java'

          dependencies {
              repositories {
          dependencies {
          dependencies {
            compile('org.hibernate:hibernate:3.0.5') {
            testCompile('org.testng:testng:6.2.1') {
            runtime files('libs/a.jar', 'libs/b.jar')
                mavenCentral()
            testCompile group: 'junit', name: 'junit',
            runtime fileTree(dir: 'libs',
            compile project(':common')
              transitive = false
              exclude module: 'guice'
              }
              version: '4.+'
          } }                include: '*.jar')
          }   dependencies {
          }
                compile 'com.google.guava:guava:r08'
              }



                                        11
Monday, November 21, 2011                                11

Configuration like scope in maven
... and classpath in ant
Repositories
                      apply plugin: 'java'

                      repositories {
                        mavenCentral()
                      }

                      dependencies {
                        compile 'com.google.guava:guava:r08'
                      }



                                         12
Monday, November 21, 2011                                      12
Repositories
                      apply plugin: 'java'

              repositories {
          repositories {
                mavenCentral()
            mavenRepo urls: "http://repo.my.com/maven2"
              }
          }
              dependencies {
                compile 'com.google.guava:guava:r08'
              }



                                        12
Monday, November 21, 2011                                 12
Repositories
                      apply plugin: 'java'

              repositories {
          repositories {
                mavenCentral()
            mavenLocal()
            mavenRepo urls: "http://repo.my.com/maven2"
              }
          }
              dependencies {
                compile 'com.google.guava:guava:r08'
              }



                                        12
Monday, November 21, 2011                                 12
Repositories
                      apply plugin: 'java'

          repositories {
              repositories {
          repositories {
            flatDir {
                mavenCentral()
            mavenLocal()
            mavenRepo urls: "http://repo.my.com/maven2"
              dirs 'lib'
              }
          } }
              dependencies {
          }
                compile 'com.google.guava:guava:r08'
              }



                                        12
Monday, November 21, 2011                                 12
Repositories
                      apply plugin: 'java'
          repositories {
          repositories {
               repositories {
            ivy {
          repositories {
            flatDir {
                 mavenCentral()
              url "http://repo.mycompany.com/repo"
            mavenLocal()
            mavenRepo urls: "http://repo.my.com/maven2"
               dirs 'lib'
               }
              layout "maven"
          } }
            }
               dependencies {
          }
          }
                 compile 'com.google.guava:guava:r08'
               }



                                        12
Monday, November 21, 2011                                 12
Coding It
                      apply plugin: 'java'

                      repositories {
                        mavenCentral()
                      }

                      dependencies {
                        compile 'com.google.guava:guava:r08'
                      }



                                              13
Monday, November 21, 2011                                      13

Tasks (like ant targets)
•Depends on
Repositories
•Uses maven
Configurations (like maven scopes)

Building simple example without plugins
Compile java and jar it
Keeping out testing and all the other stuff
Prefer functions over tasks
Coding It
                      apply plugin: 'java'

                      repositories {
                        mavenCentral()
                      }

                      dependencies {
                        compile 'com.google.guava:guava:r08'
                      }



                                              13
Monday, November 21, 2011                                      13

Tasks (like ant targets)
•Depends on
Repositories
•Uses maven
Configurations (like maven scopes)

Building simple example without plugins
Compile java and jar it
Keeping out testing and all the other stuff
Prefer functions over tasks
Multi Project

                               myproject
                                  api
                                  common
                                  web



                                    14
Monday, November 21, 2011                   14
Multi Project
                settings.gradle
                      include 'common', 'api', 'web'




                                            15
Monday, November 21, 2011                              15

Settings object - Including multiprojects
Multi Project
                settings.gradle
                      include 'common', 'api', 'web'

                      def subs(project) {
                        def children = project.children
                        children + children.collect { subs(it) }
                      }

                      subs(rootProject).flatten().each {
                        it.buildFileName = "${it.name}.gradle"
                      }



                                            15
Monday, November 21, 2011                                          15

Settings object - Including multiprojects
Multi Project
               build.gradle
                      subprojects {
                        apply plugin: 'java'
                        repositories {
                          mavenRepo urls: 'http://here'
                        }
                        dependencies {
                          compile 'com.google.guava:guava:10.0'
                        }
                      }



                                         16
Monday, November 21, 2011                                         16
Multi Project
               build.gradle
               subprojects {
                 apply plugin: 'java'
                 repositories {
                   mavenRepo urls: 'http://here'
          allprojects {
            ... }
          }      dependencies {
                   compile 'com.google.guava:guava:10.0'
                 }
               }



                                  16
Monday, November 21, 2011                                  16
Multi Project
               build.gradle
               subprojects {
                 apply plugin: 'java'
                 repositories {
                   mavenRepo urls: 'http://here'
          project(‘:common’) {
          allprojects {
            ... }
          }      dependencies {
                   compile 'com.google.guava:guava:10.0'
                 }
               }



                                  16
Monday, November 21, 2011                                  16
Multi Project
              common/common.gradle




                                  17
Monday, November 21, 2011                   17

Empty -> Remove
Multi Project
              common/common.gradle




                                  17
Monday, November 21, 2011                   17

Empty -> Remove
Multi Project
                    api/api.gradle


                      dependencies {
                        compile project(‘:common’)
                      }




                                        18
Monday, November 21, 2011                            18
Multi Project
                web/web.gradle
                      apply plugin: ‘war’

                      dependencies {
                        compile project(‘:api’)
                      }

                      war {
                        webAppDir file(‘src/main/webapp’)
                      }



                                        19
Monday, November 21, 2011                                   19
Multi Project

                                 myproject
                                    api
                                    common
                                    web



                                      20
Monday, November 21, 2011                    20

Built alphabetically
Unless dependencies
Cross module dependencies
•Single cmd to draw out result
Multi Project

                                 myproject
                                    api
                                    common


                                    web



                                      20
Monday, November 21, 2011                    20

Built alphabetically
Unless dependencies
Cross module dependencies
•Single cmd to draw out result
Multi Project

                                 myproject
                                    common
                                    api
                                    web



                                      20
Monday, November 21, 2011                    20

Built alphabetically
Unless dependencies
Cross module dependencies
•Single cmd to draw out result
Plugin Support




                                             21
Monday, November 21, 2011                                                          21

Maven plugin (uploads artifacts)
Eclipse/Idea plugin
•Never get the maven integration, nothing can be said before all config is loaded
Java / Groovy / Scala
War / Ear / Antlr / Announce / Application / Jetty
Sonar / Project Report / Code Quality
More on github
Writing Own Plugins




                                22
Monday, November 21, 2011                    22

1.Hack it together
2.Copy it
3.Create a plugin
IDE Support




                                             23
Monday, November 21, 2011                         23

Plugins for Idea and Eclipse
Idea functions very well
Not for gradle code: Gradle support in Idea 11
Netbeans being worked on (by Oracle)
IDE Support




                                             23
Monday, November 21, 2011                         23

Plugins for Idea and Eclipse
Idea functions very well
Not for gradle code: Gradle support in Idea 11
Netbeans being worked on (by Oracle)
IDE Support




                                             23
Monday, November 21, 2011                         23

Plugins for Idea and Eclipse
Idea functions very well
Not for gradle code: Gradle support in Idea 11
Netbeans being worked on (by Oracle)
IDE Support




                              ?
                                             23
Monday, November 21, 2011                         23

Plugins for Idea and Eclipse
Idea functions very well
Not for gradle code: Gradle support in Idea 11
Netbeans being worked on (by Oracle)
Performance




                                         24
Monday, November 21, 2011                     24

Generally OK
Loads all configuration
•Daemon may fix this
Calculates MD5 sums for inputs/outputs
Coming Attractions



                                  NEW
                             25




Monday, November 21, 2011                            25

Release 0.1 @ April 2008
A little immature, version 1.0m3 (1.0m4 withdrawn)
1.0 milestone 5
•Daemon (4)
•EAR, Signing (4)
•Experimental C++
•Multi process safe caches
Conclusion




                                              26
Monday, November 21, 2011                                                          26

Strangeness:
•Hard to test plugins
•Low on documentation (search mailing-list)
•Changes can be made to early or to late for the process
•Silent when it’s unable to find a project artifact (due to missing dependencies)
Perfect for reviving ant-projects
Flexible flexible flexible
:compileJava UP-TO-DATE
                      :processResources UP-TO-DATE




                            END
                      :classes UP-TO-DATE
                      :jar UP-TO-DATE
                      :assemble UP-TO-DATE
                      :compileTestJava UP-TO-DATE
                      :processTestResources UP-TO-DATE
                      :testClasses UP-TO-DATE
                      :test UP-TO-DATE
                      :check UP-TO-DATE
                      :build UP-TO-DATE

                      BUILD SUCCESSFUL

                      Total time: 3233.278 secs




                                              27
Monday, November 21, 2011                                27

Contenu connexe

Tendances

10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about Gradle
Evgeny Goldin
 

Tendances (20)

Apache Commons Pool and DBCP - Version 2 Update
Apache Commons Pool and DBCP - Version 2 UpdateApache Commons Pool and DBCP - Version 2 Update
Apache Commons Pool and DBCP - Version 2 Update
 
OSGi and Eclipse RCP
OSGi and Eclipse RCPOSGi and Eclipse RCP
OSGi and Eclipse RCP
 
Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
2 P Seminar
2 P Seminar2 P Seminar
2 P Seminar
 
Java 9 and the impact on Maven Projects (Devoxx 2016)
Java 9 and the impact on Maven Projects (Devoxx 2016)Java 9 and the impact on Maven Projects (Devoxx 2016)
Java 9 and the impact on Maven Projects (Devoxx 2016)
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
SBT Concepts, part 2
SBT Concepts, part 2SBT Concepts, part 2
SBT Concepts, part 2
 
Commons Pool and DBCP
Commons Pool and DBCPCommons Pool and DBCP
Commons Pool and DBCP
 
Petro Gordiievych "From Java 9 to Java 12"
Petro Gordiievych "From Java 9 to Java 12"Petro Gordiievych "From Java 9 to Java 12"
Petro Gordiievych "From Java 9 to Java 12"
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Arquillian in a nutshell
Arquillian in a nutshellArquillian in a nutshell
Arquillian in a nutshell
 
How can your applications benefit from Java 9?
How can your applications benefit from Java 9?How can your applications benefit from Java 9?
How can your applications benefit from Java 9?
 
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about Gradle
 
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
Gradle For Beginners (Serbian Developer Conference 2013 english)
Gradle For Beginners (Serbian Developer Conference 2013 english)Gradle For Beginners (Serbian Developer Conference 2013 english)
Gradle For Beginners (Serbian Developer Conference 2013 english)
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with Gradle
 
Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 

En vedette (10)

Android Gradle about using flavor
Android Gradle about using flavorAndroid Gradle about using flavor
Android Gradle about using flavor
 
Why gradle
Why gradle Why gradle
Why gradle
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
 
Gradle presentation
Gradle presentationGradle presentation
Gradle presentation
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Gradle
GradleGradle
Gradle
 
Gradle by Example
Gradle by ExampleGradle by Example
Gradle by Example
 
Gradle
GradleGradle
Gradle
 
An Introduction to Gradle for Java Developers
An Introduction to Gradle for Java DevelopersAn Introduction to Gradle for Java Developers
An Introduction to Gradle for Java Developers
 

Similaire à Gradle

An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
Vadym Lotar
 

Similaire à Gradle (20)

Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
02. egovFrame Development Environment workshop II en(nexus&ci)
02. egovFrame Development Environment workshop II en(nexus&ci)02. egovFrame Development Environment workshop II en(nexus&ci)
02. egovFrame Development Environment workshop II en(nexus&ci)
 
Apache Maven supports ALL Java (Javaland 2019)
Apache Maven supports ALL Java (Javaland 2019)Apache Maven supports ALL Java (Javaland 2019)
Apache Maven supports ALL Java (Javaland 2019)
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous DeliveryUsing Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous Delivery
 
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2daysUsing Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
 
Simple Build Tool
Simple Build ToolSimple Build Tool
Simple Build Tool
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
Java Tech & Tools | Grails in the Java Enterprise | Peter LedbrookJava Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorial
 
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
 
Maven
MavenMaven
Maven
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
 
Maven overview
Maven overviewMaven overview
Maven overview
 
Writing Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason LeeWriting Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason Lee
 
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
 
React Django Presentation
React Django PresentationReact Django Presentation
React Django Presentation
 
Maven
MavenMaven
Maven
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Gradle

  • 1. gradle Thor Åge Eldby Monday, November 21, 2011 1
  • 2. Thor Åge Eldby @thoraageeldby Arktekk 2 Monday, November 21, 2011 2 2.5 år in Arktekk 16 år in system development
  • 3. Build Systems make sbt 3 Monday, November 21, 2011 3 Make, batch-files (COS,Steinar Haugen,Kenneth Stigen) ant -> can compile java maven -> conventions, dependencies sbt and now gradle
  • 4. What: Repeatable ear ear ear ear 4 Monday, November 21, 2011 4 Independent from host, platform, time All information in build scripts •How •What •Externals -Ant
  • 5. What: Flexible 5 Monday, November 21, 2011 5 Possible to build Simple -Maven, Ant
  • 6. What: Readable 6 Monday, November 21, 2011 6 Not a black box Diffable GUI is not
  • 7. What: Conventions 7 Monday, November 21, 2011 7 Recognisable Structures Commands -Ant
  • 8. 8 Monday, November 21, 2011 8 Repeatable Flexible - Groovy (and ant) building DSL Readable Conventions - Follows maven structure partly Systemised, programmable ant
  • 9. Simple Example apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'com.google.guava:guava:r08' } 9 Monday, November 21, 2011 9 Needed to compile java code into jar Build DSL Script blocks (many)
  • 10. Plugin apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'com.google.guava:guava:r08' } 10 Monday, November 21, 2011 10 Interpreted script
  • 11. Dependencies apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'com.google.guava:guava:r08' } 11 Monday, November 21, 2011 11 Configuration like scope in maven ... and classpath in ant
  • 12. Dependencies apply plugin: 'java' repositories { dependencies { mavenCentral() compile project(':common') } } dependencies { compile 'com.google.guava:guava:r08' } 11 Monday, November 21, 2011 11 Configuration like scope in maven ... and classpath in ant
  • 13. Dependencies apply plugin: 'java' repositories { dependencies { dependencies { mavenCentral() testCompile group: 'junit', name: 'junit', compile project(':common') } version: '4.+' } } dependencies { compile 'com.google.guava:guava:r08' } 11 Monday, November 21, 2011 11 Configuration like scope in maven ... and classpath in ant
  • 14. Dependencies apply plugin: 'java' dependencies { repositories { dependencies { dependencies { compile('org.hibernate:hibernate:3.0.5') { mavenCentral() testCompile group: 'junit', name: 'junit', compile project(':common') transitive = false } version: '4.+' } } } dependencies { } compile 'com.google.guava:guava:r08' } 11 Monday, November 21, 2011 11 Configuration like scope in maven ... and classpath in ant
  • 15. Dependencies apply plugin: 'java' dependencies { repositories { dependencies { dependencies { compile('org.hibernate:hibernate:3.0.5') { runtime files('libs/a.jar', 'libs/b.jar') mavenCentral() testCompile group: 'junit', name: 'junit', runtime fileTree(dir: 'libs', compile project(':common') transitive = false } version: '4.+' } } include: '*.jar') } dependencies { } compile 'com.google.guava:guava:r08' } 11 Monday, November 21, 2011 11 Configuration like scope in maven ... and classpath in ant
  • 16. Dependencies apply plugin: 'java' dependencies { repositories { dependencies { dependencies { compile('org.hibernate:hibernate:3.0.5') { testCompile('org.testng:testng:6.2.1') { runtime files('libs/a.jar', 'libs/b.jar') mavenCentral() testCompile group: 'junit', name: 'junit', runtime fileTree(dir: 'libs', compile project(':common') transitive = false exclude module: 'guice' } version: '4.+' } } include: '*.jar') } dependencies { } compile 'com.google.guava:guava:r08' } 11 Monday, November 21, 2011 11 Configuration like scope in maven ... and classpath in ant
  • 17. Repositories apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'com.google.guava:guava:r08' } 12 Monday, November 21, 2011 12
  • 18. Repositories apply plugin: 'java' repositories { repositories { mavenCentral() mavenRepo urls: "http://repo.my.com/maven2" } } dependencies { compile 'com.google.guava:guava:r08' } 12 Monday, November 21, 2011 12
  • 19. Repositories apply plugin: 'java' repositories { repositories { mavenCentral() mavenLocal() mavenRepo urls: "http://repo.my.com/maven2" } } dependencies { compile 'com.google.guava:guava:r08' } 12 Monday, November 21, 2011 12
  • 20. Repositories apply plugin: 'java' repositories { repositories { repositories { flatDir { mavenCentral() mavenLocal() mavenRepo urls: "http://repo.my.com/maven2" dirs 'lib' } } } dependencies { } compile 'com.google.guava:guava:r08' } 12 Monday, November 21, 2011 12
  • 21. Repositories apply plugin: 'java' repositories { repositories { repositories { ivy { repositories { flatDir { mavenCentral() url "http://repo.mycompany.com/repo" mavenLocal() mavenRepo urls: "http://repo.my.com/maven2" dirs 'lib' } layout "maven" } } } dependencies { } } compile 'com.google.guava:guava:r08' } 12 Monday, November 21, 2011 12
  • 22. Coding It apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'com.google.guava:guava:r08' } 13 Monday, November 21, 2011 13 Tasks (like ant targets) •Depends on Repositories •Uses maven Configurations (like maven scopes) Building simple example without plugins Compile java and jar it Keeping out testing and all the other stuff Prefer functions over tasks
  • 23. Coding It apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'com.google.guava:guava:r08' } 13 Monday, November 21, 2011 13 Tasks (like ant targets) •Depends on Repositories •Uses maven Configurations (like maven scopes) Building simple example without plugins Compile java and jar it Keeping out testing and all the other stuff Prefer functions over tasks
  • 24. Multi Project myproject api common web 14 Monday, November 21, 2011 14
  • 25. Multi Project settings.gradle include 'common', 'api', 'web' 15 Monday, November 21, 2011 15 Settings object - Including multiprojects
  • 26. Multi Project settings.gradle include 'common', 'api', 'web' def subs(project) { def children = project.children children + children.collect { subs(it) } } subs(rootProject).flatten().each { it.buildFileName = "${it.name}.gradle" } 15 Monday, November 21, 2011 15 Settings object - Including multiprojects
  • 27. Multi Project build.gradle subprojects { apply plugin: 'java' repositories { mavenRepo urls: 'http://here' } dependencies { compile 'com.google.guava:guava:10.0' } } 16 Monday, November 21, 2011 16
  • 28. Multi Project build.gradle subprojects { apply plugin: 'java' repositories { mavenRepo urls: 'http://here' allprojects { ... } } dependencies { compile 'com.google.guava:guava:10.0' } } 16 Monday, November 21, 2011 16
  • 29. Multi Project build.gradle subprojects { apply plugin: 'java' repositories { mavenRepo urls: 'http://here' project(‘:common’) { allprojects { ... } } dependencies { compile 'com.google.guava:guava:10.0' } } 16 Monday, November 21, 2011 16
  • 30. Multi Project common/common.gradle 17 Monday, November 21, 2011 17 Empty -> Remove
  • 31. Multi Project common/common.gradle 17 Monday, November 21, 2011 17 Empty -> Remove
  • 32. Multi Project api/api.gradle dependencies { compile project(‘:common’) } 18 Monday, November 21, 2011 18
  • 33. Multi Project web/web.gradle apply plugin: ‘war’ dependencies { compile project(‘:api’) } war { webAppDir file(‘src/main/webapp’) } 19 Monday, November 21, 2011 19
  • 34. Multi Project myproject api common web 20 Monday, November 21, 2011 20 Built alphabetically Unless dependencies Cross module dependencies •Single cmd to draw out result
  • 35. Multi Project myproject api common web 20 Monday, November 21, 2011 20 Built alphabetically Unless dependencies Cross module dependencies •Single cmd to draw out result
  • 36. Multi Project myproject common api web 20 Monday, November 21, 2011 20 Built alphabetically Unless dependencies Cross module dependencies •Single cmd to draw out result
  • 37. Plugin Support 21 Monday, November 21, 2011 21 Maven plugin (uploads artifacts) Eclipse/Idea plugin •Never get the maven integration, nothing can be said before all config is loaded Java / Groovy / Scala War / Ear / Antlr / Announce / Application / Jetty Sonar / Project Report / Code Quality More on github
  • 38. Writing Own Plugins 22 Monday, November 21, 2011 22 1.Hack it together 2.Copy it 3.Create a plugin
  • 39. IDE Support 23 Monday, November 21, 2011 23 Plugins for Idea and Eclipse Idea functions very well Not for gradle code: Gradle support in Idea 11 Netbeans being worked on (by Oracle)
  • 40. IDE Support 23 Monday, November 21, 2011 23 Plugins for Idea and Eclipse Idea functions very well Not for gradle code: Gradle support in Idea 11 Netbeans being worked on (by Oracle)
  • 41. IDE Support 23 Monday, November 21, 2011 23 Plugins for Idea and Eclipse Idea functions very well Not for gradle code: Gradle support in Idea 11 Netbeans being worked on (by Oracle)
  • 42. IDE Support ? 23 Monday, November 21, 2011 23 Plugins for Idea and Eclipse Idea functions very well Not for gradle code: Gradle support in Idea 11 Netbeans being worked on (by Oracle)
  • 43. Performance 24 Monday, November 21, 2011 24 Generally OK Loads all configuration •Daemon may fix this Calculates MD5 sums for inputs/outputs
  • 44. Coming Attractions NEW 25 Monday, November 21, 2011 25 Release 0.1 @ April 2008 A little immature, version 1.0m3 (1.0m4 withdrawn) 1.0 milestone 5 •Daemon (4) •EAR, Signing (4) •Experimental C++ •Multi process safe caches
  • 45. Conclusion 26 Monday, November 21, 2011 26 Strangeness: •Hard to test plugins •Low on documentation (search mailing-list) •Changes can be made to early or to late for the process •Silent when it’s unable to find a project artifact (due to missing dependencies) Perfect for reviving ant-projects Flexible flexible flexible
  • 46. :compileJava UP-TO-DATE :processResources UP-TO-DATE END :classes UP-TO-DATE :jar UP-TO-DATE :assemble UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build UP-TO-DATE BUILD SUCCESSFUL Total time: 3233.278 secs 27 Monday, November 21, 2011 27