我有一个我在Jenkins建立的Java / Scala / Akka项目。对于它,我收到了这个错误:
configure
我查找了错误,例如How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version,原因是使用了旧版本的Java而不是Java 8.
所以我添加了Jenkins JAVA_HOME=/my/path/to/jdk/1.8/exec
// TestVC.swift
// WinterdienstTest
//
// Created by zwipf on 09.02.17.
// Copyright © 2017 Squirrel. All rights reserved.
//
import UIKit
class TestVC: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var tableView: UITableView!
let sections: [String] = ["Tour 1", "Tour 2", "Tour 3"]
var adressTour1: [String] = []
var adressTour2: [String] = []
var adressTour3: [String] = []
var adressTourALL: [Int: [String]] = [:]
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
tableView.dataSource = self
// URL abrufen
let url = NSURL(string: "https://api.myjson.com/bins/mml65")
let request = NSMutableURLRequest(url: url! as URL)
let task = URLSession.shared.dataTask(with: request as URLRequest) { data,response,error in
// JSON parsen und Ergebins in eine Liste von assoziativen Arrays wandeln
let responseString = try! JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [String:Any]
// Daten auslesen
if let Liegenschaften = responseString["Liegenschaften"] as? [AnyObject] {
for liegenschaft in Liegenschaften {
if let Winterdienst = liegenschaft["Winterdienst"] as? [AnyObject] {
for winterdienst in Winterdienst {
let tour = winterdienst["Tour"] as! String
if tour == "1" {
let adresse = liegenschaft["Adresse"] as! String
self.adressTour1.append(adresse)
}
if tour == "2" {
let adresse = liegenschaft["Adresse"] as! String
self.adressTour2.append(adresse)
}
if tour == "3" {
let adresse = liegenschaft["Adresse"] as! String
self.adressTour3.append(adresse)
}
}
}
}
}
self.adressTourALL = [0:self.adressTour1, 1:self.adressTour2, 2:self.adressTour3]
}
// UI-Darstellung aktualisieren
//OperationQueue.main.addOperation {
// self.tableView.reloadData()
//}
// task.resume()
print(self.adressTourALL)
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return adressTourALL.count
}
func numberOfSections(in tableView: UITableView) -> Int {
return sections.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCell(withIdentifier: "cell")
if cell == nil {
cell = UITableViewCell(style: .default, reuseIdentifier: "cell");
}
print(adressTourALL[indexPath.section]![indexPath.row])
cell!.textLabel!.text = adressTourALL[indexPath.section]![indexPath.row]
return cell!
}
}
。
但是,错误仍然存在。那可能是什么原因?
答案 0 :(得分:-1)
请在Jenkins配置中添加JDK 8,并在作业配置中设置已配置的JDK。那里没什么难的。