I didn't know what to write in Maven's scope so I looked it up

When importing to pom.xml when using Maven, I usually pick it up from the net and copy it, but I stumbled on the fact that the tag differs depending on the thing, so make a note.

According to the official (Dependency Scope: Maven – Introduction to the Dependency Mechanism), there are five main types. There is a pattern. (6 types including ʻimport` added in Maven 2.0.9, which can be used only in Dependent pom --dependencyManagement)

|Scope type|Description| |:--|:--| | compile |This is the default value when the scope specification is omitted. It will be added to the classpath in all situations.| | provided |Specify if the library is provided by the JDK or container. It is added to the classpath only at compile time.| | runtime |Specify if required only at runtime. It is added to the classpath during test execution and normal execution.| | test |Specify if required only for testing. It is added to the classpath when compiling and running the test.| | system |Specify if you want to explicitly add it to the classpath. Libraries in this scope are always considered valid and do not search the repository.|

3. Introduction to Maven (2) | TECHSCORE

At pinpoint, I was at a loss because there were cases where there was a scope for JDBC as shown below, but [Maven dependency range --CodeFlow](https://www.codeflow.site/ja/article/maven- According to dependency-scopes), the runtime seems to be good.

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>6.0.6</version>
    <scope>runtime</scope>
</dependency>

Recommended Posts

I didn't know what to write in Maven's scope so I looked it up
I didn't understand the topological sort, so I looked it up and implemented it in BFS, and then tried to solve the AtCoder problem.
I don't know, so I'm going to write a list (you don't have to read it)
I think it's okay to write joins etc. in the scope
[Action View :: Missing Template] I didn't understand the meaning of the error statement, so I looked it up.
I didn't understand the meaning of injection such as DI or @Autowired, so I looked it up.
First AWS Lambda (I tried to see what kind of environment it works in)
I introduced Docker to Rails 6, so I summarized it (beginner)
firewalld went wrong, so I managed to fix it.
I tried to find out what changed in Java 9
I was wondering if Stream / ParallelStream / For would use multiple cores, so I looked it up.
How to batch initialize arrays in Java that I didn't know when I was a beginner
I entered from Rails and didn't know what [attr_accessor] was
What I did in the version upgrade from Ruby 2.5.2 to 2.7.1