I’ve seen Gradle becoming more popular in recent years, but it wasn’t too long ago that Maven was the tool for managing dependencies and building/packaging apps.
From my own experience with both, here’s the commonly used equivalent commands:
Maven
Gradle
mvn compile
No equivalent as gradle build compiles and packages?
mvn package
gradle build
mvn install (see note below)
gradle build
mvn test
gradle test
There is no direct equivalent to ‘mvn install’ in gradle, but if you depend on a local Maven repo, there is a Gradle plugin to publish packaged artifacts to a Maven repo – see here.
The frontend code running in your browser for the web page that you’re looking at right now is immediately visible, so it’s easy to understand why new developers are overly focused on becoming a mobile app or web developer. The go-to skills every new developer wants to learn today are HTML, CSS and JavaScript (plus any frontend specific framework/library like React, Vue or Angular).
We’re lucky in our industry that the majority of tools a developer needs to build a website are freely available right there on your computer already. With a web browser and only a text editor (although realistically you should be using an IDE, but even many IDEs are also free) you can write HTML, CSS and JavaScript and test it in your browser. For free. As long as you can afford even a cheap laptop, there are no other commercial products or tools you need to purchase to get started. It’s no wonder in recent years we’ve been seeing a ‘Gold Rush’ with so many new developers rushing in to get a start in the industry. As with any other Gold Rush in history though, just because others before you have ‘made it rich’ doesn’t mean that you’ll also be successful.
It’s common to see new prospective new developers discussing online and sharing advice on how they are building a website to show in interviews as a portfolio project. Given the ubiquitous nature of websites and the fact that it’s relatively cheap and easy to get started with website development, it’s really no surprise that this is where new developers are focusing their skill development and job searches.
The thing that gets overlooked though, is that the large majority of software developed today is not for websites, and most large software systems don’t even use HTML or CSS (since they don’t have a web frontend). it’s also likely most large systems are not built with JavaScript (although NodeJS is being used more widely for backend processing). If you pause to take a look around you, unless you are standing in the middle of a field, you’re likely surrounded by electronic devices that are dependent on software control systems, almost every electronic device in your home has some sort of system that controls it’s features: TVs, clothes washers/dryers, microwave ovens, regular overs
If you have a car , it has an engine control system that runs 100M lines of code, likely developed in C or C++, systems that have no visible frontend or user interface. Screen based entertainment systems, sat nav, and digital dial displays (replacing analog speedometer and tachometer dials) only add additional systems on top of this with additional millions of lines of code.
It’s easy to see why HTML/CSS/JavaScript gets the attention and focus that is does because of the tools are mostly free (other than the cost of a laptop) and the highly visible nature of the websites we use every day. In terms of volume of code developed for the devices that surround us in our every day lives, websites and frontend tech are still only a fraction of what we interact with in the electronic devices we use every day.
I’ve used Maven for years for dependency management, but Gradle has better support for initializing a new Java source project compared to Maven. Although Maven has archetypes, I can never remember the syntax so usually just copy and paste a pom.xml file from somewhere else.
With Gralde you can ‘gradle init’ a new project and just follow the prompts:
> gradle init
Welcome to Gradle 8.1.1!
Here are the highlights of this release:
- Stable configuration cache
- Experimental Kotlin DSL assignment syntax
- Building with Java 20
For more details see https://docs.gradle.org/8.1.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
Select type of project to generate:
1: basic
2: application
3: library
4: Gradle plugin
Enter selection (default: basic) [1..4] 2
Select implementation language:
1: C++
2: Groovy
3: Java
4: Kotlin
5: Scala
6: Swift
Enter selection (default: Java) [1..6] 3
Generate multiple subprojects for application? (default: no) [yes, no] n nolease enter 'yes' or 'no':
Select build script DSL:
1: Groovy
2: Kotlin
Enter selection (default: Groovy) [1..2] 1
Select test framework:
1: JUnit 4
2: TestNG
3: Spock
4: JUnit Jupiter
Enter selection (default: JUnit Jupiter) [1..4] 1
Project name (default: java21playground):
Source package (default: java21playground):
Enter target version of Java (min. 7) (default: 21):
Generate build using new APIs and behavior (some features may change in the next minor release)? (no
> Task :init
Get more help with your project: https://docs.gradle.org/8.1.1/samples/sample_building_java_applications.html
BUILD SUCCESSFUL in 1m 7s
2 actionable tasks: 2 executed
With Maven you add your dependencies to a <dependencies> block in your pom.xml, like
Dependencies with the default scope are considered part of your compile and runtime classpath, <scope>test</scope> indicates on the test classpath only.
With Gradle you do the same with your build.gradle properties file, in the dependencies section:
I had a random thought: “What is the earliest trace of my own online activity that you easily find today?”. It’s hard to get search engines to return search results in date order, but Google Groups does. As well as hosting it’s own discussion groups, they also have an archive of most Usenet groups, including this one that I posted to on December 28th 1995:
There are several other posts in 1998 and 1999 asking questions about ‘Dynamic HTML’, or dHTML as it was known back then, while I was working on some dynamic webpage features with Javascript on IE5, which at the time I remember was the ‘new big thing’:
The interesting thing about the Enhanced CD I was asking about in 1995 is that I still have this CD:
On a modern desktop PC with an external USB DVD drive, the disk is only recognized as an audio CD. The audio plays fine, but it doesn’t recognize the Enhanced media content. The internal CD drive in my Mac G5 does see the additional content though – it mounts the disc as 2 volumes, 1 for the audio tracks and 1 for the data content:
The data volume has several movie files and screenshots:
What’s more interesting is the format of the movie files. Remember this CD was released in November 1995 – this was at the start of the era of ‘multimedia PCs’, Windows 95 had launched a couple of months earlier in August 1995. Look the format of the video files:
320 x 240 pixels (!)
Mono 22kHz audio
15 fps
1 minute 37 seconds – this is only a fraction of the length of the audio single, it’s not even a complete video for the single
This same format is used for all the video clips, 24 in total:
It’s worth remembering the Windows 95 install CD shipped with a similarly low resolution, but full length, music video of Weezer’s Buddy Holly track, so this is a typical example of the technology at the time, although interesting why they decided to only include short 1 min clips and not full length music videos on the Stones CD.
It’s amazing looking back now when we’re able to stream 4k and 8k content and take it for granted, this was the start of consuming media content on a computer.