我的Spring依赖有多破碎?

时间:2018-05-07 21:31:29

标签: spring spring-boot spring-security spring-social

有人告诉我,我的项目依赖性存在严重问题,而且坦率地说 - 在某些时候,我有点忘记了我实际需要的东西以及什么不是。

我所拥有的设置是"工作"而且我的意思是我没有任何我所知道的问题。但是有些事情比如

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-facebook</artifactId>
    <version>3.0.0.M1</version>
</dependency>
<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-security</artifactId>
    <version>2.0.0.M4</version>
</dependency>
<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-core</artifactId>
    <version>2.0.0.M2</version>
</dependency>
<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-config</artifactId>
    <version>2.0.0.M2</version>
</dependency>

这是我尝试实施Facebook注册的结果,特别是来自

  1. the docs
  2. 的事实
  3. Facebooks API changed和Spring Social还没有赶上
  4. &#34; oh well it actually did &#34;最后到
  5. &#34; but if you think that's it you're wrong &#34;
  6. 因为过去发生了一两次,我想知道我能做些什么来确保我的应用程序稳定

    整个 pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>mz</groupId>
        <artifactId>server</artifactId>
        <packaging>jar</packaging>
        <version>1.0-SNAPSHOT</version>
    
        <properties>
            <spring.boot.version>2.0.1.RELEASE</spring.boot.version>
        </properties>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.1.RELEASE</version>
        </parent>
    
        <dependencies>
    
            <!-- Spring Framework Boot -->
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-rest</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </dependency>
    
            <!-- Spring Social -->
    
            <!--
             BEFORE TOUCHING ANYTHING:
                This whole thing for Spring Social looks like this because of
                https://stackoverflow.com/a/42175408/826983
                so be sure you know what you're doing when changing the dependencies.
                The Facebook API changed hence spring-social-facebook 3.0.0.M1 is being used.
                But there will be required dependencies missing hence we also include some other dependencies.
                Just see the stackoverflow link.
            -->
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-thymeleaf</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.social</groupId>
                <artifactId>spring-social-facebook</artifactId>
                <version>3.0.0.M1</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.social</groupId>
                <artifactId>spring-social-security</artifactId>
                <version>2.0.0.M4</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.social</groupId>
                <artifactId>spring-social-core</artifactId>
                <version>2.0.0.M2</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.social</groupId>
                <artifactId>spring-social-config</artifactId>
                <version>2.0.0.M2</version>
            </dependency>
    
            <!-- Spring Security -->
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-security</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-jwt</artifactId>
                <version>1.0.9.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security.oauth</groupId>
                <artifactId>spring-security-oauth2</artifactId>
                <version>2.3.2.RELEASE</version>
            </dependency>
    
    
            <!-- PostgreSQL Driver -->
    
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>42.1.4</version>
            </dependency>
    
            <!-- Swagger -->
    
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>2.7.0</version>
            </dependency>
    
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>2.7.0</version>
            </dependency>
    
            <dependency>
                <groupId>com.sun.mail</groupId>
                <artifactId>javax.mail</artifactId>
                <version>1.5.5</version>
            </dependency>
    
            <!-- Flyway -->
    
            <dependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-core</artifactId>
            </dependency>
    
            <!-- Google -->
    
            <dependency>
                <groupId>com.google.maps</groupId>
                <artifactId>google-maps-services</artifactId>
                <version>0.2.6</version>
            </dependency>
    
            <!-- Misc. -->
    
            <dependency>
                <groupId>commons-dbcp</groupId>
                <artifactId>commons-dbcp</artifactId>
                <version>1.4</version>
            </dependency>
    
            <dependency>
                <groupId>com.jayway.jsonpath</groupId>
                <artifactId>json-path</artifactId>
                <scope>test</scope>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-jsr310</artifactId>
                <version>2.9.2</version>
            </dependency>
    
            <!--
            WARNING:
                Removing this may break Unit tests.
                (see: https://stackoverflow.com/questions/27341604/exception-when-using-testresttemplate)
            -->
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <scope>test</scope>
            </dependency>
    
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
        <!-- Dependency Management -->
    
        <dependencyManagement>
    
            <dependencies>
    
                <!-- Import dependency management from Spring Boot -->
    
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-dependencies</artifactId>
                    <version>${spring.boot.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
    
            </dependencies>
    
        </dependencyManagement>
    
        <repositories>
            <repository>
                <id>spring-milestones</id>
                <name>Spring Milestones</name>
                <url>https://repo.spring.io/libs-milestone</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
    
            <repository>
                <id>alfresco-public</id>
                <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
            </repository>
        </repositories>
    
    </project>
    

1 个答案:

答案 0 :(得分:0)

版本号不匹配。我可以看到人们可能会认为这是多么混乱:所有数字都不同,这是否意味着传递依赖性是不同的,并且我已经为未来的一些不可能调试错误做好准备了?

它可能没有那么糟糕。它也可能是。打败我,让我们问电脑......

mvn dependency:tree将打印出依赖项及其子依赖项列表。甚至mvn dependency:tree -Dverbose甚至会打印出更多信息。 (冲突可能会被标记为:我自己还没有使用过该工具的那部分......)