gpt4 book ai didi

java - 如何在 Azure DevOps 上部署 Java Web 应用程序

转载 作者:行者123 更新时间:2023-12-01 16:35:22 24 4
gpt4 key购买 nike

我正在尝试将 Spring Boot 中开发的 Java Web 应用程序部署到 Azure Devops。 pom.xml 和 Build Pipeline 也运行良好,但不知何故它没有指向任何内部文件结构。我们的类服务和 Controller 位于/src/main/java/com/corrigo 但是当在 pom.xml 中添加这些内容时,它仍然重定向到 Azure 欢迎开发人员页面,我们的主启动文件位于/src/main/java/com/corrigo/demo/CorrigoModoApplication.java

我认为问题出在 pom.xml 中。任何人都可以帮助我理解我哪里出了问题吗?

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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

<groupId>com.example</groupId>
<artifactId>corrigoModo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>corrigoModo</name>
<description>corrigo project for Spring Boot</description>

<properties>
<java.version>1.8</java.version>
<!-- <src.dir>src/main/java</src.dir> -->
</properties>

<build>

<sourceDirectory>${project.basedir}/src/main/java/com/corrigo</sourceDirectory>

<!--<sourceDirectory>${src.dir}</sourceDirectory> -->

<!-- <profiles>
<profile>
<id>development</id>
<properties>
<src.dir>${project.build.directory}/com/corrigo</src.dir>
</properties>
</profile>
</profiles> -->

<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<skipTests>false</skipTests>
<testFailureIgnore>true</testFailureIgnore>
<forkMode>once</forkMode>
</configuration>
</plugin>

<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-webapp-maven-plugin</artifactId>
<version>1.9.1</version>
<configuration>
<schemaVersion>V2</schemaVersion>
<resourceGroup>***************</resourceGroup>
<appName>********</appName>
<region>********</region>
<pricingTier>**</pricingTier>
<runtime>
<os>linux</os>
<javaVersion>jre8</javaVersion>
<webContainer>jre8</webContainer>
</runtime>
<!-- Begin of App Settings -->
<appSettings>
<property>
<name>corrigoModo</name>
<value>-Dserver.port=80</value>
</property>
</appSettings>
<!-- End of App Settings -->
<deployment>
<resources>
<resource>
<directory>${project.basedir}/target</directory>
<includes>
<include>*.jar</include>
</includes>
</resource>
</resources>
</deployment>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- <version>${maven-surefire-plugin.version}</version> -->
<configuration>
<!-- Force alphabetical order to have a reproducible build -->
<runOrder>alphabetical</runOrder>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>

<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>com.medium.article</generatePackage>
<schemaDirectory>src/main/resources/wsdl</schemaDirectory>
<schemaIncludes>
<schemaInclude>*.wsdl</schemaInclude>
</schemaIncludes>
</configuration>
</plugin>
</plugins>

</build>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
<!-- <dependency> <groupId>org.springframework.ws</groupId> <artifactId>spring-ws-security</artifactId>
</dependency> -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.4.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<!-- <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-jwt</artifactId>
</dependency> -->
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>adal4j</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>oauth2-oidc-sdk</artifactId>
<version>4.5</version>
</dependency>
<!-- <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId>
</dependency> -->

<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<!-- <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <type>maven-plugin</type> </dependency> -->

<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>


<dependency>
<groupId>wss4j</groupId>
<artifactId>wss4j</artifactId>
<version>1.5.1</version>
</dependency>
</dependencies>

最佳答案

Build Pipeline is also running fine but somehow its not pointing to any internal file structure. 

既然构建/部署成功,您应该首先检查应用程序是否已经部署在Azure中。

如果有,您可能使用了错误的 URL,因此它始终重定向到 Azure 欢迎开发人员页面。

导航到 Web 应用程序并从概述边栏选项卡中选择 URL。将 /[yourappname] 上下文添加到 URL。例如 - http://myshuttle1.azurewebsites.net/myshuttledev

更多详情请看此博客--Deploying a Java-based Tomcat application to Azure

关于java - 如何在 Azure DevOps 上部署 Java Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61960706/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com